dnn_from_scratch_py | project provides the python code | Machine Learning library
kandi X-RAY | dnn_from_scratch_py Summary
kandi X-RAY | dnn_from_scratch_py Summary
This project provides the python code that supports this blog post (if you are a beginner, you should read it). The goal is to make a neural network from scratch using numpy, then the same one using TensorFlow. As a toy example, we try to predict the price of car using online data. download_lbc_cars_data.py downloads data from leboncoin.fr, which is a website of classified ads. The data retrieved are about BMW Serie 1 (only one model of car). For each BMW Serie 1 we save an input with the number of km, fuel, age and the price. The data are saved into car_features.csv. These data are then normalized by normalize_lbc_cars_data.py to produce normalized_car_features.csv. normalized_car_features.csv is used as input by dnn_from_scratch.py which is the neural network using numpy and dnn_from_scratch_tensorflow.py which is the neural network using TensorFlow. predict.py is used to transform the data back and forth from the normalized to the human readeable version. For instance to predict a price, the user will input the raw car attributes. predict.py will convert the raw data to the normalized version and return them. The neural network output is also given to predict.py so that the user obtains a readable price and not a normalized one. Overall results are pretty good knowing that the price is impacted by more than three attributes.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Check the gradients
- Compute the gradient
- Compute the numerical gradient of the objective function
- Forward forward computation
- Gradient of the cost function
- Compute the cost function
- Set the weights
- Predict price
- Return the output of the given price
- Calculate input
- Gradient of the cost function
- Function to tanh
- Print a summary of the loss function
- Calculate the r2
- Forward the network
- Predict new features
- Gradient of the gradients
- Calculate the input matrix
- Return the output of a price
dnn_from_scratch_py Key Features
dnn_from_scratch_py Examples and Code Snippets
Community Discussions
Trending Discussions on dnn_from_scratch_py
QUESTION
I wrote an article explaining in depth how a neural network works from scratch.
To illustrate the blog post, I wrote the neural network in python using numpy and I wrote a version using TensorFlow. I uploaded the code on Github to illustrate this question but this is not a clean version.
The goal of the network is to predict the price of a car based of three of its features (km, type of fuel, age) this is a toy example that I created from scratch.
I retrieved data from the leboncoin.fr, my dataset is composed of around 9k cars (only BMW serie 1). I normalized the data so that the price is between [0, 1], the type of fuel is binary encoded and the age and number of kms are normalized using the mean and standard deviation.
The neural network architecture is really simple and I am using only three car attributes, nonetheless the results of my non tensorflow network are pretty good. The validation test set gives:
...ANSWER
Answered 2017-Mar-27 at 08:56The problem isn't the Optimizer, it's your loss. It should return the mean loss, not the sum. If you're doing an L2 regression, for instance, it should look like this:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install dnn_from_scratch_py
You can use dnn_from_scratch_py like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page