Galaxy Classification with Neural Nets

Deepti R.
2 min readAug 27, 2018

--

Hey there! This is my first blog. I hope you like it :)

This project implements a neural network on tabular data. It is called Deep Astronomy (Deep learning for astronomy). Practicing during learning works best for me. This was my first neural network project and I got a pretty good accuracy of 93%.

We use a neural network to classify whether a galaxy is spiral, elliptical or irregular/uncertain.

Spiral galaxies look like this. It has arms and has an orientation. Spins clockwise or anti clockwise.

Spiral galaxy

Elliptical galaxies look like this: It is elliptical in shape and the ellipticity ranges from E0 to E7 (E0 being perfectly circular and E7 being very stretched).

Elliptical galaxy

Irregular/Uncertain galaxy: They have no definite shape.

Irregular galaxy

This blog requires understanding of working of neural networks and knowledge of python (pandas, keras).

Dataset: The dataset was taken from the Galaxy zoo dataset http://galaxy-zoo-1.s3.amazonaws.com/GalaxyZoo1_DR_table2.csv.zip

We use 10 parameters: NVOTE, P_EL, P_CW, P_ACW, P_EDGE, P_DK, P_MG, P_CS, P_EL_DEBIASED, P_CS_DEBIASED as input. We discard the first 3 columns as they don’t affect the results of the network.

The output is one hot encoded as SPIRAL, ELLIPTICAL and UNCERTAIN.

We fill in the missing values with their means. Then we split them into train set (75%) and test set (25%). Then we use a standard scalar to normalize the values and feed it into the neural network.

A standard scalar normalizes or standardizes the values such that it ranges from -1 to +1. This makes it easier for the network to compute.

standardized value = (sample - mean)/standard deviation

Input layer must have 10 nodes as there are 10 inputs (features). Output layer must have 3 nodes as there are 3 outputs. The two hidden layers can have 6 nodes each, to start with.

Activation function for each layer from input to output: relu-relu-sigmoid

Optimizer - adam and loss -binary_crossentropy

Batch size = 10, epochs = 10

Accuracy obtained = 93%

Code can be found here: https://github.com/deep-r/Galaxy-NN

Thank you for reading! :)

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Deepti R.
Deepti R.

Written by Deepti R.

Budding blogger | Software Engineer

No responses yet

Write a response