-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
30 lines (21 loc) · 1.1 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import json
from regression import *
from utilityFunctions import *
import multiprocessing
if __name__ == '__main__':
dataPath = "datasets/" + input("Enter the name of the dataset(json only): ")
file = open(dataPath)
data = json.load(file)
xDim = input("Enter the X dimension from the dataset: ")
yDim = input("Enter the Y dimension from the dataset: ")
regressionAlgorithms = [LinearRegression(data,xDim,yDim),ExponentialRegression(data,xDim,yDim),
ReciprocalRegression(data,xDim,yDim),PolynomialRegression(data,xDim,yDim),
LogarithmicRegression(data,xDim,yDim)]
processes = [multiprocessing.Process(target=processFitting(x)) for x in regressionAlgorithms]
for process in processes:
process.start()
for process in processes:
process.join()
leastCostingProcess = getLeastErrorAlgorithm(regressionAlgorithms)
leastCostingProcess.visualize("Function with best fitting: "+leastCostingProcess.functionString()
+"\nMean squared error: "+str(round(leastCostingProcess.error,4)))