def calculateLambda(self, data1, data2, num_pois): distance = [] data_viz = dataViz.DataViz() for i, poi in data2.iterrows(): distance.append(self.algo.calculateDis(poi, data1)) coordonnee = self.drawPoint(distance, num_pois) coordonnee.append(data1['product_name']) return coordonnee
'water-hardness_100g', 'choline_100g', 'phylloquinone_100g', 'beta-glucan_100g', 'inositol_100g', 'carnitine_100g' ] df = dataCenter.cleanData(df, colslist) cols = df.columns.values.tolist() df.info() clean_brand = cleanBrand.CleanBrand() dfBrand1 = clean_brand.getBrandsClean() df['brand1'] = dfBrand1 df['brand1'] = df['brand1'].fillna(value='NoBrand', axis=0) # 计算两条记录的2gram的余弦值 algo = algoDis.AlgoDis() data_Viz = dataViz.DataViz() # 并行!!!! num_pois = 5 num_divide_df = 100 # 开始选取参考点 timeStartKmeans = time.localtime() print('choose POIs: ' + str(timeStartKmeans)) list_pois, pois = dataCenter.selectPOIs(df.iloc[1:5000], num_pois) # list_pois, pois = dataCenter.selectPOIsRandom(num_pois,df) list_pois_labels = [] for index in list_pois: list_pois_labels.append(index) df_copy = df df_copy = df_copy.drop(list_pois, axis=0)