Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python Machine Learning I need help doing supervised learning. Then choose the best model among all the training models. As well as doing cross-validation, random

Python Machine Learning

I need help doing supervised learning. Then choose the best model among all the training models. As well as doing cross-validation, random forest, knn. And create some graphics in order to chose the best predictor (ex: seaborn).

My CSV is:

image text in transcribed

The types of my data frame are:

title object p float64 watchers int64 brand object color object speeds float64 type object used int64 dtype: object

What Ive done for the moment, but that doesnt work:

1. Transform object column by int:

df=pd.read_csv(data)

df['brand'] = df['brand'].map({'cannondale':0, 'elite':1, 'other':2})

etc...

2. X = df.drop(['p','title'], axis=1) y = df['p']

(Im not sure thats right, but it works)

3. X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2, random_state = 0)

4. rfc = RandomForestClassifier(random_state=0)

5. rfc.fit(X_train, y_train) But I have a warning here: ValueError: Unknown label type: 'continuous'

I dont know how to solve this problem, and I'd like to have help also for the following.

title p watchers brand color no_of_speeds bike_type item_condition_used 0 elite 20" bmx stealth bicycle freestyle bike 1... 289.0 297 other other 12.0 other 0 1 elite 20" bmx stealth bicycle freestyle bike 1... 269.0 379 other white 1.0 other 0 2 elite 20" bmx stealth bicycle freestyle bike 1... 269.0 431 other black 12.0 other 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2012 Administration

Authors: Adam Jorgensen, Steven Wort

1st Edition

1118106881, 9781118106884

More Books

Students also viewed these Databases questions