0
0
ML Pythonml~10 mins

Simple neural network with scikit-learn in ML Python - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the neural network model from scikit-learn.

ML Python
from sklearn.neural_network import [1]
Drag options to blanks, or click blank then click option'
ALinearRegression
BDecisionTreeClassifier
CKNeighborsClassifier
DMLPClassifier
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a model that is not a neural network like LinearRegression.
Confusing MLPClassifier with other classifiers.
2fill in blank
medium

Complete the code to create a neural network model with one hidden layer of 5 neurons.

ML Python
model = MLPClassifier(hidden_layer_sizes=([1],), max_iter=1000)
Drag options to blanks, or click blank then click option'
A5
B10
C3
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using an integer without tuple parentheses.
Choosing the wrong number of neurons.
3fill in blank
hard

Fix the error in the code to train the model on data X_train and y_train.

ML Python
model.[1](X_train, y_train)
Drag options to blanks, or click blank then click option'
Afit
Btransform
Cpredict
Dscore
Attempts:
3 left
💡 Hint
Common Mistakes
Using predict instead of fit to train the model.
Using transform which is for data preprocessing.
4fill in blank
hard

Fill both blanks to predict labels for X_test and calculate accuracy score.

ML Python
predictions = model.[1](X_test)
accuracy = [2](y_test, predictions)
Drag options to blanks, or click blank then click option'
Apredict
Baccuracy_score
Cfit
Dpredict_proba
Attempts:
3 left
💡 Hint
Common Mistakes
Using fit instead of predict for predictions.
Using predict_proba instead of predict for labels.
5fill in blank
hard

Fill all three blanks to import accuracy_score, create the model, and train it.

ML Python
from sklearn.metrics import [1]
model = MLPClassifier(hidden_layer_sizes=([2],), max_iter=1000)
model.[3](X_train, y_train)
Drag options to blanks, or click blank then click option'
Aaccuracy_score
B5
Cfit
Dconfusion_matrix
Attempts:
3 left
💡 Hint
Common Mistakes
Importing confusion_matrix instead of accuracy_score.
Using wrong hidden layer size or method to train.