Skip to content

Instantly share code, notes, and snippets.

@kayhman
Last active October 6, 2020 08:39
Show Gist options
  • Save kayhman/8774e142ba3cfb21f7dd30d9f9a0dec8 to your computer and use it in GitHub Desktop.
Save kayhman/8774e142ba3cfb21f7dd30d9f9a0dec8 to your computer and use it in GitHub Desktop.
import numpy as np
def linear_predictions(weights, inputs):
# y = weights[0] inputs[0] + weights[1] * inputs[1]
# where inputs[0] = 1.0
return np.dot(inputs, weights) * 60.0 # minutes
v_avg = 30 # km/h
startup_time = 2 /60.0 # hours
inputs = np.array([[1.0, 6.0],
[1.0, 4.0 ]])
weights = np.array([startup_time, 1.0 / v_avg]) # Program params are estimaed by experience, stats analysis, Least Square Error, ...
print("Predictions:", linear_predictions(weights, inputs))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment