Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # in this example, we'll create a heatmap of our correlation matrix
- plt.figure(figsize=(16,16))
- sns.heatmap(df.corr(), annot=True, fmt=".2f")
- print(df.corr()['price_range'].sort_values(ascending=False))
- # X = df[['ram','battery_power','px_width', 'px_height', 'int_memory', 'sc_w', 'sc_h', 'pc', 'talk_time', 'mobile_wt']]
- # trying with a new phone
- # new phone, outside the dataset
- # for exmaple, if we we used fields: ['ram','battery_power','px_width', 'px_height']
- # then, do something like this:
- # X = df[['ram','battery_power','px_width', 'px_height', 'int_memory', 'sc_w', 'sc_h', 'pc', 'talk_time', 'mobile_wt']]
- np_ram = 4096
- np_battery = 1500
- np_px_width = 600
- np_px_height = 1200
- np_intmemory = 32
- np_scw = 5
- np_sch = 12
- np_pc = 24
- np_talk_time = 12
- np_mobile_wt = 150
- # build the phone
- new_phone = [[np_ram, np_battery, np_px_width, np_px_height, np_intmemory, np_scw, np_sch, np_pc, np_talk_time, np_mobile_wt]]
- # what's the price range? scale the data and give it to model
- new_phone = sc.transform(new_phone)
- result = categories[np.argmax(model.predict(new_phone))]
- print(f"\nPredicted price category: {result}")
Advertisement
Add Comment
Please, Sign In to add comment