def getDic(): # temp=pickle.load(open('data2/delx,y', 'rb')) # x=temp['x'] # y=temp['y'] # r={} # for i,yi in enumerate(y): # if yi in r: # r[yi].append(x.getrow(i)) # else: # r[yi]=[x.getrow(i)] # result={k:{"matrix":vstack(r[k])} for k in r} # pickle.dump(result, open('data2/class_mat', 'wb')) # result={} # for k in r: # result[k]={"matrix":vstack(r[k])} result = pickle.load(open('data2/class_mat', 'rb')) rv = rv_continuous() for k in result: print( str(k) + ":" + time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))) list = [] for i in range(result[k]["matrix"].shape[1]): stds = np.std(result[k]["matrix"].getcol(i).todense(), axis=0) list.append(stds[0][0]) if i % 10000 == 0: print("i:" + str(i) + ":" + time.strftime( '%Y-%m-%d %H:%M:%S', time.localtime(time.time()))) print(str(k) + ":" + str(len(list))) pickle.dump(list, open('data2/std_' + str(k), 'wb'))
def __init__(self, name=None, type=None, mean=None, stdv=None, startpoint=None, p1=None, p2=None, p3=None, p4=None, input_type=None): self.name = name self.type = type self.mean = mean self.stdv = stdv self.startpoint = None self.setStartPoint(startpoint) self.p1 = p1 self.p2 = p2 self.p3 = p3 self.p4 = p4 self.input_type = input_type self.rv = stats.rv_continuous()
def __init__(self, name=None,type=None,mean=None,stdv=None,startpoint=None,p1=None,p2=None,p3=None,p4=None,input_type=None): self.name = name self.type = type self.mean = mean self.stdv = stdv self.startpoint = None self.setStartPoint(startpoint) self.p1 = p1 self.p2 = p2 self.p3 = p3 self.p4 = p4 self.input_type = input_type self.rv = stats.rv_continuous()
month_demand.groupby('month', as_index=False).sum()) week_demand['demand'] = week_demand['demand'] * 10 month_demand['demand'] = month_demand['demand'] * 10 #month_demand.drop(month_demand.tail(1).index, axis = 0, inplace = True) #month_demand.drop(month_demand.head(1).index, axis = 0, inplace = True) history_data = Biweek_demand[ 'demand'].values #[140,130,120,110,100,100,90,90,90,70,60,60,60,60,60,40,40,40,40] #history_data = [10,30,150,90,120,320,40,410,170,170,60,60,150,90,150,330,100,60,70,60,100,90,210,130,140,40,40,110,60,40,20,20] #history_data = [i for i in history_data if i >=300] history_data = history_data[history_data > 100] #history_data = history_data[history_data>200] params = gamma.fit(history_data) params = rv_continuous(gamma, history_data) statistic, pvalue = kstest(history_data, gamma.cdf, params) print('gamma: %f %f' % (statistic, pvalue)) print(params) params = norm.fit(history_data) statistic, pvalue = kstest(history_data, "norm", params) print('norm: %f %f' % (statistic, pvalue)) params = exponweib.fit(history_data) statistic, pvalue = kstest(history_data, "exponweib", params) print('weibull: %f %f' % (statistic, pvalue)) params = expon.fit(history_data) statistic, pvalue = kstest(history_data, "expon", params) print('expon: %f %f' % (statistic, pvalue))
def test_no_name_arg(self): """If name is not given, construction shouldn't fail. See #1508.""" stats.rv_continuous() stats.rv_discrete()
} parameters_k_nearest_neighbors_classifier = { "algorithm": ["auto", "ball_tree", "kd_tree", "brute"], "leaf_size": sp_randint(15, 45), "metric": ["euclidean", "manhattan", "minkowski"], "n_neighbors": sp_randint(2, 8), "p": [1, 2], "weights": ["uniform", "distance"], } parameters_radius_neighbors_classifier = { "algorithm": ["auto", "ball_tree", "kd_tree", "brute"], "leaf_size": sp_randint(15, 45), "metric": ["euclidean", "manhattan", "minkowski"], "outlier_label": ["Unknown"], "p": [1, 2], "radius": rv_continuous(1.0, 3.0), "weights": ["uniform", "distance"], } parameters_gaussian_naive_bayes = {} parameters_never_functional = [] parameters_support_vector_classifier = [{ 'kernel': ['rbf'], 'gamma': [1e-3, 1e-4], 'C': [1, 10, 100, 1000] }, { 'kernel': ['linear'], 'C': [1, 10, 100, 1000] }] # # names = [