all_data=pd.read_csv('../input/laptops.csv',encoding = "ISO-8859-1")
def get_id_specs(all_data, typeName, company, inches, memory, ram, price, weight):
all_data1=all_data.append({'Company' : company, 'TypeName' : typeName , 'Inches' : inches, 'Ram' : ram, 'Memory' : memory, 'Weight' : weight, 'Price_euros' : price},ignore_index=True)
all_data_dummies=pd.get_dummies(all_data1, drop_first=True)
scaler=MinMaxScaler(feature_range=(-1, 1))
all_data_dummies=scaler.fit_transform(all_data_dummies)
#dt=DistanceMetric.get_metric('pyfunc',func=all_data1)
nbrs = NearestNeighbors(n_neighbors=4, algorithm='auto').fit(all_data_dummies)
distances, indices=nbrs.kneighbors(all_data_dummies)
mask=all_data1.index.isin(indices[-1][1:])
print(mask)
return all_data1.doc[mask]
get_id_specs(all_data, 'Apple', 2, 13.3, 128, 8, 898.94, 1.34)
Получение ошибки:
fit () должно иметь аргумент y