It’s because accuracy_score is for classification tasks only.
For regression you should use something different, for example:
clf.score(X_test, y_test)
Where X_test is samples, y_test is corresponding ground truth values. It will compute predictions inside.
More Related Contents:
- Why does the following code cant get value of n_fold = 1?
- pandas dataframe columns scaling with sklearn
- How to iterate over rows in a DataFrame in Pandas
- How to deal with SettingWithCopyWarning in Pandas
- Combine two pandas Data Frames (join on a common column)
- Pandas split column into multiple columns by comma
- Repeat rows in a pandas DataFrame based on column value
- pandas .at versus .loc
- How to deal with multi-level column names downloaded with yfinance
- Replace all occurrences of a string in a pandas dataframe (Python)
- Running get_dummies on several DataFrame columns?
- Python – How to convert JSON File to Dataframe
- How to remove timezone from a Timestamp column in a pandas dataframe
- Pandas lookup from one of multiple columns, based on value
- How to add a suffix (or prefix) to each column name?
- Pandas get the most frequent values of a column
- Subtract two columns in dataframe
- How to do “(df1 & not df2)” dataframe merge in pandas?
- Capitalize first letter of each word in a dataframe column
- Compute the running (cumulative) maximum for a series in pandas
- How do I assign values based on multiple conditions for existing columns?
- Get total of Pandas column
- Python Pandas replace NaN in one column with value from corresponding row of second column
- How to read a Parquet file into Pandas DataFrame?
- Get first and second highest values in pandas columns
- Enumerate each row for each group in a DataFrame
- Remove ends of string entries in pandas DataFrame column
- How to convert DataFrame.append() to pandas.concat()?
- How to efficiently assign unique ID to individuals with multiple entries based on name in very large df
- Difference between df[x], df[[x]], df[‘x’] , df[[‘x’]] and df.x