Implementing hidden layers in NN with Python and NumPy

layers
layers
Photo by Hasan Almasi on Unsplash

In a previous article, we built a Logistic Regression from scratch as an example of shallow Neural Network. Now let’s increase complexity a bit and add one hidden layer. Even though the math get slightly more complicated (I hope you enjoy derivatives!), we can still code the whole network with just Python and NumPy.

Logistic Regression worked well in a case where data was linearly separable, but we can see it doesn’t work as well when the it’s not linearly separable anymore. As an example, let’s use again scikit-learn to generate some data.


Your Haircut Is More Than A Styling Choice

women hair, gender bias and feminism
women hair, gender bias and feminism
Photo by Element5 Digital on Unsplash

The first time I cut my hair short, a boy at school told me I looked like a man. I felt terrible. To his defence, we were in 5th grade, and I looked like a man. My mom had to cut my hair extremely short after my sister thought chopping a sizable chunk off with a pair of children’s safety scissors was a good idea.

That was the first time I experienced the stigma associated with women wearing short hair. A stereotype which society bakes into our brains from a young age.

This episode happened over twenty years ago, but…


3 easy recipes with just cupboard ingredients

Photo by Nick Fewings on Unsplash

As the supermarket shelves stripped bare at the beginning of the COVID-19 pandemic reminded us, canned and jarred foods are life-savers. For many reasons, really.

They last (almost) forever. As long as the container is properly sealed, the food inside will be safe to eat and perfectly preserved for many months, if not years. It is always a good idea to keep your pantry stocked with a wide range of canned food. You never know when you will not have time for grocery shopping or receive unexpected guests, or just need a last-minute food fix. …


An implementation from scratch with Python and NumPy

Photo by Jeswin Thomas on Unsplash

As with many things in life, the best way to learn something is to do it yourself. I learned Neural Networks by myself, and what I thought was most helpful to understand their inner workings, was to build one from scratch. In fact, it is possible to manually derive all the formulas and implement them with just basic Python libraries.

Let’s see how that works for a Logistic Regression, which is a very simple example of a Neural Network. …


7 time-saving tips for your weekly meal prep

meal prep ingredients laid out on table
meal prep ingredients laid out on table
Photo by Brooke Lark on Unsplash

Many people think meal prep is a daunting task, but it doesn’t have to be.

I started meal prepping when I was studying to get my Ph.D. I am sure you know, but grad school pays close to nothing. Buying lunch every day was too expensive for my tiny budget, and the choice was either cooking my food or live under a bridge. I opted for the first.

The whole thing might have started out of necessity, but here I am, several years later, still doing it. As with everything, there is a learning curve but, the truth is, once…


7 tried and tested tips for a successful resume

Tips for successful CV
Tips for successful CV
Photo by Bram Naus on Unsplash

If you have an analytical background, you probably haven’t had many difficulties attracting a recruiter’s interests.

The demand for Data Scientists has soared, but the number of Data Scientists out there is nowhere near enough to meet it: annual AI-related hiring has grown 74% since 2015, but global tech talent shortage is projected to reach 85M by 2030 (Source: https://quanthub.com/data-scientist-shortage-2020/).

Given the blooming job market, you might think you don’t need to put much effort into your CV. As long as the relevant stuff is in there, people won’t care, am I right? Wrong.

While it might not be too…


And What You Can Do To Prevent It

Photo by Jo Szczepanska on Unsplash

Companies are investing in AI and Machine Learning more than ever, yet most data science projects fail. Up to 85% of Machine Learning projects never get deployed to prediction. The reasons can be different: data is low quality or difficult to access, or there might be a lack of appropriate architecture.

A common reason is a misalignment between the business and the science team. Different expectations on the outcome can be enough to derail a Data Science project.

Projects fail even before they start. The moment you don’t confirm the specifics of the job you are committing to do with…


A selection of the very best food the Land of the Rising Sun has to offer

Photo by Daniel Schludi on Unsplash

I am a big fan of street food. One reason is convenience. When I am out and about travelling or sightseeing or simply doing things, I don’t necessarily want or can stop for a seated meal during the day. Sometimes I might have limited time but still want to make the most of my visit so I would prefer something portable, quick and easy so that i can be on my way sooner. And I don’t have to compromise on taste either; street food can be just as delicious and satisfying. …


Because what you don’t want in your next role is just as important

Photo by Shane Aldendorff on Unsplash

One thing we seem to forget when we are looking for our next role is that the job interview is for the candidate as much as it is for the employer. We tend to be so preoccupied with acing that interview that we fail to recognise potential red flags; we may then end up in a role that is not what we expected it to be, prompting us to fall out with our jobs really quickly. While this is generally true for every job, it is particularly so for Data Scientists.

Research shows that Data Scientists don’t stay long in…

Federica Cerina

Data Scientist | Wants to be a Griffindor but is more likely a Hufflepuff

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store