In this project will be bulit neural network model which must compute the price of the house in Boston according to some prepared data
- pandas, numpy, os
- matplotlib
- pathlib
- tensorflow, keras (sequential, layers, dense, flatten, batchnoramliztaion, etc.)
- matplotlib
- sickit-learn.model_selection.train_test_split
We'll import all the nescessary modules, use Pandas to make pandas dataframe and see that we've got
then check the .details() to be sure we don't have missing values, othervise we must use "impute" to build that missing values
then we can save from our dataset the last 'n' rows, for future testings, if we need it. Next we shuffle our data with .sample and keeping the 90%
We'll use sickit-learn's model_selection.train_test_split to split our dataset into "train" and "some_test"
then just split again "some_test" into "valid" and "test" (50% for each of them)
We need to pop each of newmade datasets to make our labels.
And we can see that our dataset's values aren't scaled, so we can make special function for normalization (we could use StandardScaler() instead)
We'll use Keras and Tensorflow to build our model.
our model will have 7 layers (1 input , 1 output , 5 hidden)
each of them will have 'selu' activation and we'll use batch_normalization before each time we move to the next layer
here's the summary of our model:
![Screen Shot 2023-08-08 at 15 50 04](https://private-user-images.githubusercontent.com/110426439/259089284-79a5e70a-2325-4563-9b1f-0587686424ca.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQxNDI2NjksIm5iZiI6MTcyNDE0MjM2OSwicGF0aCI6Ii8xMTA0MjY0MzkvMjU5MDg5Mjg0LTc5YTVlNzBhLTIzMjUtNDU2My05YjFmLTA1ODc2ODY0MjRjYS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODIwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgyMFQwODI2MDlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1jYTgzZTIxNjUxYzZiMGYyNmIyMDM3MjVjODBhYmJhZDM4MDM4MTY0MDA5ODcwOTMzNWY4NzM0NDUxYTkzMzljJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.91nN8LgqnuoBb58buBvOjYGbR1gCqRJwVy6OwE7QP4M)
Start the training with the used number of batch_size and epochs
after that we'll get our "loss" "mse" "mae" "mape" for our train and validation sets
with .history() we can check them
For the test, just take some datapoints from test dataset (for example 10 datapoints) and train our model on them
with special modules , we can see the process of the training according to the changes of trainig and validation sets
In some point as our dataset isn't that large or it's noisy MIGHT get overfitted.
and in this graphic we can see the linear relation between our predicted values and the truth ones.