1

SGD Regressor

Unsolved
Supervised

Difficulty: 2 | Problem written by zeyad_omar
Problem reported in interviews at

Amazon
Apple
Facebook
Google
Netflix

Stochastic Gradient Descent is a supervised learning algorithm that uses gradient descent to optimize the weights (parameters).

In this problem, you are asked to use sklearn to implement an SGDRegressor to predict the output of the model on X_test after training itt on X_train and y_train.

PLEASE use these hyperparameters to match the output of our test cases

loss='squared_loss'

penalty="l2"

shuffle=False

Sample Input:
<class 'list'>
X_train: [[4.6, 3.1, 1.5, 0.2], [5.9, 3.0, 5.1, 1.8], [5.1, 2.5, 3.0, 1.1]]
<class 'list'>
y_train: [0, 2, 1]
<class 'list'>
X_test: [[5.8, 2.8, 5.1, 2.4], [6.0, 2.2, 4.0, 1.0], [5.5, 4.2, 1.4, 0.2]]

Expected Output:
<class 'numpy.ndarray'>
[1.89823124 1.37810635 0.24915125]

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Perspiciatis praesentium ipsa itaque nam eos libero neque numquam, recusandae quia ea saepe fugit dolorum quas a maxime eaque fugiat placeat, quia eligendi soluta maxime corrupti praesentium quo explicabo debitis est eos, reiciendis nisi obcaecati at minus? Impedit quas delectus explicabo consectetur est magni deserunt labore, dolor ipsam voluptatum saepe minus libero modi nesciunt accusantium ut quasi. Quasi accusamus aut quibusdam ea eos.

Illum nobis voluptas praesentium quibusdam ipsam cum dolore, rerum quisquam adipisci harum cumque repellendus, nihil quo similique hic debitis reiciendis sit nostrum earum perspiciatis, amet eum mollitia accusantium fugit soluta iure nesciunt ipsa hic? Hic quam est quidem sequi in repudiandae quaerat eos molestiae facilis ipsa.

Fuga hic ad assumenda repellendus blanditiis cum quasi, officiis sed deserunt? Dolores optio vitae eos at vero sunt reprehenderit, deleniti quis itaque, reprehenderit quae doloribus totam exercitationem est deleniti ipsam enim, ex eius sit?

This is a premium feature.
To access this and other such features, click on upgrade below.

Ready.

Input Test Case

Please enter only one test case at a time
numpy has been already imported as np (import numpy as np)