Neural networking gender prediction

Download the full Code and Trained Data @ just $1

Neural networking gender prediction!  Hello, guys in this post you will find a cool way to get started with Artificial Neural Networking aka ANN. I am using an NPM package of node js called synaptic js.

Click here to see the demo 

Neural networking gender prediction

Command to install synaptic js

You will also need fs-extra, underscore, cluster packages. Neural Networking using node js

Importing packages

As you can notice I have imported cluster package just to train the updated training sets in a periodic time interval in a separate thread.

Create the environment #neural_networking_gender_prediction

The above code fetches the env from environment file that you need to create as env.json and put the code below

#Neural Networking using node js

//env.json

Neural networking gender prediction

Templating

We are using ejs as node js templating to render HTML files

Predict

We are activating a network here also know as an activation function

Neural networking gender prediction

To be specific  var result = network.activate(convertNameToInput(req.query.name));  this line is responsible for it. It will simply use its trained brain to predict the gender of a name.

The training

Neural networking gender prediction

  1. Create a list of initial training data this is specifically to JSON file called male.json and female.json
  2. We will read once the training data and skip if its already trained.
  3. We will then train the network using the initial training data
  4. The cost calculation function that I am using is MSE aka Mean Square Error
  5. Test the set and finally save the trained data in a json file called trainingset.json

Background training based on user’s corrections

We also train the set in the background that is why we imported node js package “Cluster” for multithreading.

Demo

Neural networking gender prediction
Neural networking gender prediction

The full code

Download link is below 🙂

neural networking gender prediction

Download the full Code and Trained Data @ just $1$

You are free to comment if you have any doubt.

Leave a Comment