1/ To generate the model, plot the results and print the statistics:
$> python3 linreg.py <file.csv> -ps
Output with training on current dataset:
2/ Then use the model to predict, for example, the price of a car given its mileage. The script will use the model generated by the linreg.py
script and saved in the <theta.csv> file.
$> python3 prediction.py
Example of input/output:
The dataset used for training is in the file data.csv
, you can generate another one using the generate_dataset.py
script. It will generate a dataset with 2 columns. The data are based on the result of the model generated by the linreg.py
script. (Not really happy with the results, I will improve it if needed.)
To use it, run:
$> python3 dataset_generator.py <filename> <number_of_rows>