#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 8 23:05:54 2017
@author: lu
"""
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from keras.layers.core import Activation, Dense
from keras.models import Sequential
from sklearn.linear_model import Lasso
"""
GM11--> Custom gray prediction function
programmer_1--> Read the file to extract basic information
programmer_2--> With a custom gray prediction function , To make predictions
programmer_3--> Build a neural network model , Make predictions and draw predictions
programmer_4--> A set of data is predicted using a custom gray prediction model , And draw pictures
"""
def GM11(x0):
# 1-AGO Sequence , Cumulative sum
x1 = np.cumsum(x0)
# Next to the mean (MEAN) Generating sequences
z1 = (x1[:-1] + x1[1:]) / 2.0
z1 = z1.reshape(len(z1), 1)
B = np.append(-z1, np.ones_like(z1), axis=1)
Yn = x0[1:].reshape((len(x0) - 1, 1))
# Matrix computing , Calculate the parameters
[[a], [b]] = np.dot(np.dot(np.linalg.inv(np.dot(B.T, B)), B.T), Yn)
# Reduction value