I've written a program that finds the difference between data and gives output. Here's the code:
import json
import numpy as np
print("This is a basic machine learning thing.")
baseData = {"collecting":True,"x":[],"y":[]}
while baseData["collecting"]:
baseData["x"].append(float(input("X:")))
baseData["y"].append(float(input("Y:")))
if input("Do you want to keep feeding data? Press enter for yes, or type anything for no.") != "":
baseData["collecting"] = False
if len(baseData["x"]) == len(baseData["y"]):
xdata = baseData["x"]
ydata = baseData["y"]
nums = []
for i in range(len(xdata)):
nums.append(xdata[i] - ydata[i])
median = np.median(nums)
else:
print("malformed data")
def getY(x):
pass
while True:
data = input("X/Data:")
print(int(data)-median)
To work the program, give it X and Y data, then give it X data and it will predict Y data.