0424机器学习使用时间序列
import datetime
import numpy as np
import pandas as pd # 时间序列 pd.date_range(datetime.datetime(2016,1,1),periods=31) pd.date_range(datetime.datetime(2019,2,1),periods=28) pd.date_range("2019-1-1", periods = 28) ts1 = pd.Series(np.arange(31), index = pd.date_range("2019-1-1", periods = 31)) ts1["2019-1-3"] ts1.index[2] ts1.index[2].year,ts1.index[2].month,ts1.index[2].week,ts1.index[2].weekday()
import numpy as np def sigmod(x): return 1/(1+np.exp(-x)) def softmax(x): exp_sum = np.sum(np.exp(x)) return np.exp(x)/exp_sum sigmod_test = np.array([1 , 2]) softmax_test = np.array([100, 200, 300, 400]) sigmod(sigmod_test) softmax(softmax_test) def softmax(x): sum_exp = np.sum(np.exp(x-np.max(x))) return np.exp(x-np.max(x))/sum_exp softmax_test = np.array([1000, 2000, 3000, 4000]) softmax_test = np.array([100, 200, 300, 400]) softmax(softmax_test)
扶我起来 我还能敲代码