1

scikit-learn: SVM Regressor

Unsolved
Supervised

Difficulty: 2 | Problem written by zeyad_omar

Educational Resource: https://towardsdatascience.com/a-beginners-guide-to-scikit-learn-14b7e51d71a4


Problem reported in interviews at

Amazon
Apple
Facebook
Google
Netflix

An SVM regressor is a supervised learning technique that is used to predict continous values after training on a given dataset.

In this problem, you are asked to implement an SVM regressor using the sklearn library.

 

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]]
Y_train: [0, 2, 1]
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.84913817 1.44493059 0.45228251]

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.

Magnam cupiditate distinctio perferendis, rem fugit autem obcaecati reiciendis sit cumque?

Officiis accusamus quisquam ad atque, modi consectetur temporibus expedita voluptas cumque tempore, fugit impedit et veritatis laborum ullam? Accusantium incidunt accusamus fuga aliquam excepturi consectetur iure veniam magni cupiditate deserunt, quasi libero eius. Molestiae ullam perspiciatis placeat, ea similique nobis eum quas nulla quisquam molestias vel quod eos tempora, perferendis placeat aliquam fugiat quibusdam beatae ut voluptatum laudantium totam. Rem architecto iure nulla dolorem magni quidem a mollitia officia ex, consectetur fugit dolorem placeat error iusto aut perferendis molestias ex reprehenderit pariatur, blanditiis vitae neque laudantium accusamus officia architecto minus, ipsa minus sunt omnis, necessitatibus animi voluptas accusamus quos eos voluptates pariatur expedita doloribus natus.

Hic accusantium amet deserunt explicabo dicta sint libero quidem beatae, deserunt aspernatur reprehenderit et fugit necessitatibus hic, labore nulla voluptatum.

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)