Workspace
Haythem Karchoud/

Supervised Learning with scikit-learn

0
Beta
Spinner

Supervised Learning with scikit-learn

Run the hidden code cell below to import the data used in this course.

# Importing pandas
import pandas as pd

# Importing the course datasets 
diabetes = pd.read_csv('datasets/diabetes_clean.csv')
music = pd.read_csv('datasets/music_clean.csv')
advertising = pd.read_csv('datasets/advertising_and_sales_clean.csv')
telecom = pd.read_csv("datasets/telecom_churn_clean.csv")

Take Notes

Add notes about the concepts you've learned and code cells with code you want to keep.

Add your notes here


from sklearn.module import Model
model = Model()
model.fit(X, y) #X = array of our **FEATURES** AND y an array of our **TARGET VARIABLE**
predictions = model.predict(X_new)
print(predictions)
from sklearn.neighbors import KNeighborsClassifier
X = churn_df[["total_day_charge", "total_eve_charge"]].values # our set of features
y = churn_df["churn"].values # target variable 
print(X.shape, y.shape) 
(3333,2), (3333,) #3333 (rows)observations and 2 (columns) or features.
Hidden output
  • AI Chat
  • Code