2

Prediction with Weights

Unsolved
Neural Networks
Supervised

Difficulty: 3 | Problem written by Mr. Umair
Prediction in supervised learning often looks like this:

\(intermediate = sum(weight_i * x_i) + bias\)

These intermediate values are used for prediction using a step transfer function:

\(prediction = 1.0 \: if \: intermediate >= 0 \: else \: 0\)

Input:

You will be given two variables, i.e. a 2D array containing the dataset and 1D array of weights. The dataset format will be:
      X1                             X2 

2.7810836            2.550537003        
1.465489372        2.362125076        
7.627531214        2.759262235        
5.332441248        2.088626775        
6.922596716        1.77106367          

Weights = [-0.1, 0.20653640140000007, -0.23418117710000003]

Output:

Your function will return a list of predicted values, i.e. a list of predictions using the two formulae above.

Sample Input:
<class 'list'>
dataset: [[2.7810836, 2.550537003], [1.465489372, 2.362125076], [3.396561688, 4.400293529], [1.38807019, 1.850220317], [3.06407232, 3.005305973], [7.627531214, 2.759262235], [5.332441248, 2.088626775], [6.922596716, 1.77106367], [8.675418651, -0.242068655], [7.673756466, 3.508563011]]
weights: [-0.1, 0.20653640140000007, -0.23418117710000003]

Expected Output:
<class 'list'>
[0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0]

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.

Possimus corporis quas quod fugiat fuga maxime nulla, quibusdam officia tempore veniam soluta mollitia, molestiae asperiores consequuntur repellendus minima quae animi voluptatem voluptate nam ipsum vitae. Quia magni odit ducimus minima ad, nesciunt neque reprehenderit libero perspiciatis ipsam doloremque cupiditate exercitationem commodi consequatur eveniet.

Quaerat odit quasi dolorum modi illum, animi sed dolore tenetur inventore consectetur autem ducimus in commodi ipsum?

Atque sunt doloribus unde enim, eius incidunt maxime doloribus recusandae voluptate tempore consequatur ducimus. Perferendis officia inventore voluptatem unde libero assumenda odit quae repellendus, iure commodi fugit ipsam ullam debitis adipisci dignissimos labore, expedita aspernatur nihil quibusdam alias accusantium cumque porro ipsam quam. Nisi alias earum at aliquam culpa officiis veritatis ipsam laudantium minima.

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)