#DreamBig – Build your career by learning emerging technologies

In this era of technology, competition is at an all-time high. All the engineers, developers, and other people of technical inclination are fighting hard to stay relevant in their technological domain of expertise, but the actual truth is, these domains themselves are changing. With newer and more advanced tech springing out of laboratories and computers every second, the technological sector as we all see it, and have seen it, is getting transformed. 

For budding developers and engineers, it makes sense to dream big, and learn about as many emerging technologies as they can. From data science, to analytics, to AI and ML- the horizon is broad, and opportunities lie at every step. Finding it hard to decide which tech to side with? Let’s help you out.

What’s more valuable than money?


Lots and lots of data.

How to manage that data? It’s all about data science. Labeled as one of the most high-profile and upcoming jobs in the tech industry, data science has the potential to be one of the most exciting yet high-paying career choices for individuals. It encompasses roles such as data scientist, data manager, data engineer, and architect.

Data science usually revolves around designing processes for data mining, modelling, and research. Data analytics, which is another application of data science (in basic terms), is another popular option for those who want to work on the Holy Grail that is data. Starting salaries for anyone in the data science field are on the higher side, with experience playing a large part in the number written on the paycheck.

Cybersecurity-helping people and organizations stay safe online

Let’s admit it, the sheer volume of data also brings the risk of being misused or stolen. Naturally, the demand for someone who can secure your data and help avoid any mishaps is pretty high. Arguably, there has never been a better time to consider a career in cybersecurity.

Professionals in cybersecurity have a wide range of responsibilities, ranging from responding to incidents, securing data, assessing vulnerabilities, and monitoring traffic. Roles with banks, and other financial organizations are prominent, since these entities work with money, which ultimately becomes a natural target for those with malicious intent.

The field of cybersecurity itself offers many opportunities specific to individual interests. One could become a security auditor and help organizations figure out their weaknesses before hackers do. On the other hand, one could also venture into the world of security engineering, and help build systems that are safe and sound. The possibilities are endless.

Blockchain and cryptocurrency

Amidst all the furore that Bitcoin and other cryptocurrencies have created, the underlying technology, blockchain, has been slipping into other industries seamlessly. Thought of as a tech that could only power the fintech industry, blockchain today is being used to manage supply chain operations, assist in efficient healthcare, and what not.

It is natural that the career prospects of a technology so polarizing would be exciting, to say the least. Blockchain developers and project managers are in high demand, since the organizations that are in favor of this decentralized ledger technology are actively looking to make full use of it. Languages such as GO, and platforms such as Ethereum have been specifically developed to work on the blockchain concept, so one could very well imagine the opportunities for work that lie in this domain.

Augmented/Virtual reality

Virtual reality and augmented reality are concepts that have literally changed how we see the world. Sitting in our houses, we can now explore the Amazonian jungles, or immerse ourselves into a gaming experience so real, it’s as if you were there. Who makes this possible?

Virtual reality software developers, that’s who. With VR and AR working on a digital medium, the apps and software have to be developed from the ground up. This places a lot of responsibility on the shoulders of developers, which is fairly compensated with attractive salaries. Therefore, if you have a genuine interest in creating an immersive augmented or virtual reality experience, there’s one thing that you don’t need to worry about, and that is money. Career options are aplenty, just try it out!

Artificial intelligence and machine learning-the ever present

AI has touched almost every human life in more ways than one. Siri, Alexa, and Google Assistant are just some of the many examples as to how we use AI in our daily lives, and the amalgamation of AI and machine learning is, for lack of a better word, breathtaking.

Almost all tech giants employ AI and ML today, therefore, the career scope is by no means limited. You could work on neural networks at a company like Epic Games, which deploy the aforementioned tech in many of their game titles. If you’re more into the AI side of things, maybe Amazon’s Alexa department would be a good fit for you!

Emerging technologies are slowly but surely taking the world by storm. Do yourself a favour, take a step ahead of the curve, make yourself an expert in one of these, and kickstart your career!

From Novice To Expert: Roadmap to become an expert in Machine Learning

There is no denying that machine learning is the future. With the advent of Big Data, the machine learning boom has taken the tech industry by storm. However, machine learning is not very easy. You have to invest a lot of time to become an expert in machine learning. The best way to approach machine learning is by a step-by-step guide. It will help you deal with the subject slowly without getting too overwhelmed by it. Here are a few ways which can make you a machine learning expert:

  1. Understanding the basics

Before diving into machine learning, you need to know what you are getting into. Just knowing a few basics will not help – you have to be aware of the finer details in machine learning. Learn what analytics, Big Data, Artificial Intelligence, Data Science are and how they are related to one another. 

  1. Learning basic statistics

pasted image 0 (9)

When you research on the basics of machine learning, you will often come across many statistical applications. So, what should be your next step? Brush up your statistics. You don’t have to be an expert in statistics, but you need to learn a few topics in statistics. It will be essential in machine learning. A few topics you should work on are sampling, data structures, linear and multiple regression, logistic regression, probability, etc.

  1. Learning a programming language

While researching machine learning, you will learn about the different programming languages which support machine learning. When you learn these programming languages, you become familiar with many applications of machine learning like data preparation, data cleaning, quality analysis, data manipulation, and data visualization.

  1. Taking up an Exploratory Data Analysis project

pasted image 0 (10)

Exploratory Data Analysis means analyzing data sets and then explaining or showing that summary presented by that data set, mostly in a visual format. In this project, charts, diagrams, or other visual representations can be used to display the data. A few topics that need to be covered here are Single variable explorations, visualization, pair-wise, and multi-variable explorations.

  1. Creating unsupervised learning models

pasted image 0 (11)

Unsupervised learning model is a machine learning technique where you do not need to supervise the model. It will discover information on its own and work on it. For example, if you give the basic parameters of several countries like population, income distribution, demographics, etc., unsupervised learning models can help you find out which countries are most similar. It uses unsupervised machine learning algorithms. It can be grouped into two kinds of problems: Clustering and Association. Two Unsupervised learning algorithms are k-means for clustering problems or the Apriori algorithm for association rule learning problems.

  1. Creating supervised learning models

Supervised learning models are a kind of learning where you teach and train the machine to use labelled data to arrive at the right conclusion. After training the machine with the labelled data, you have to provide some training examples to see if it produces the right outcome. For example, if you provide the specific descriptions of an apple (Red, Rounded) and a banana (Yellow, long curving cylinder) to the machine, then it can separate the two fruits and put them in their respective categories. Logistic regression and Classification trees are a few topics you need to cover here.

  1. Understanding Big Data Technologies

The machine learning models being used today were there in the past too. However, we can make full use of them now because nowadays, we have access to large amounts of data. Big data systems stores and control the vast amounts of data that are used in machine learning. So, if you are making your way to be an expert in machine learning, you should research and understand Big Data Technologies.

  1. Exploring Deep Learning Models

pasted image 0 (12)

Top tech companies like Google and Apple are working with deep learning models to make Google Assistant and Siri better. Deep learning models help machines listen, write, read, and speak. Even vehicle tests are now conducted using deep learning models. Learn about topics like Artificial Neural Networks, Natural Language Processing, etc. Start by making your model differentiate between a fruit and a flower. That’s a great start and will set a pattern for future learning.

  1. Completing a data project

Finally, find a data project and work on it. You can search for a data project on the internet. Work on it and showcase your skills. There’s nothing for fulfilling and educative as the proper application of machine-learning.

Benefits of Machine Learning

Machine learning is one of the most innovative technologies which is being used by top companies like Amazon, Apple, and Google. Now, the question is: what are the benefits of Machine learning? Here are a few benefits of machine learning:

  • Identifying trends and patterns

Machine learning can review large sets of data and identify trends and patterns based on it. For example, Amazon can direct notifications to buyers based on their purchasing and browsing history of a user.

  • Constant Improvement 

Machine learning algorithms improve over time. With the increase of data input, machine learning will be more accurate and help in making better predictions.

  • No human intervention 

With machine learning, machine algorithms learn by themselves and improve themselves automatically. So, you don’t have to invest all your time in it.

  • Different kinds of data 

Machine Learning algorithms can handle multi-dimensional and multi-variety data easily and is thus, very efficient in handling large data sets.

  • Many Applications

The applications of machine learning are expanding. From being used software like Siri to even driverless vehicle testing, machine learning is becoming the future in many industries. It is also being included in healthcare industries. Machine learning applications are far and wide.

Job Prospects of Machine Learning

Machine Learning is one of the hottest careers in the market right now. Top tech firms like Amazon, Google, and Apple, are integrating machine learning with their software. According to Gartner, AI will be creating 2.3 million jobs in 2020. These jobs will require research and developing algorithms. Machine learning scientists will have to extract patterns from Big Data too. Some hot career positions are:

  • Machine Learning Engineer
  • Machine Learning Analyst
  • Data Sciences Lead
  • Machine Learning Scientist
  • NLP Data Scientist 

Machine learning is going to be difficult, but in the end, it will be a fulfilling ride. If you wish for expert guidance, you can take help from the Coding Ninjas machine learning course.

Tips and tricks on how to succeed in Kaggle competitions

You are probably aware by now that machine learning is the future of AI and business culture. Many tech firms are already starting to integrate machine learning into their systems. Since this ‘thing of the future’ is gaining such popularity, you might ask, ‘How can I be better at it?’ Kaggle competitions can be the answer for you! Like Hackerrank, Codechef, etc., Kaggle is a platform where you compete with other participants for a prize. 

The difference is: Kaggle focuses on data science and machine learning. It’s a perfect platform for anyone passionate about machine learning! However, winning a Kaggle competition is not going to be a cakewalk. You have to really prepare and plan for it to succeed. Here are some tips to help you get your first win in a Kaggle competition:

  • Practice feature engineering and data preparations

Preparing the data and engineering the features are the critical data-related factors in machine learning. Algorithm selection is also very important though not as important as feature engineering and data preparation. So, use your common sense or intuition and figure out what actually works and what doesn’t work. You can create a cross-validation framework to get a reliable estimate of your errors. Work on them to minimize the chances of committing future errors.

  • Choosing the right kind of competition



You may have heard the saying ‘Confidence is the key to success’. While that is true, the saying does not talk about building your confidence. The best way to build up your confidence is by taking ‘small’ steps towards a big success. It’s like a video game where you start acquiring certain skills while playing the first level, and then, level up when you master them. With Kaggle competitions, it’s best to start small, that is, from Level 1. Research and find competition with fewer competitors. These competitions may have lesser prizes than the bigger and more famous ones, but they are great for building your confidence levels. Eventually, you may move up to the high-valued and famous competitions. 

  • Don’t give up

Three things that can help you win a Kaggle competition are: Persistence, Constant learning, and Luck. While persistence and learning are within your control, you cannot control the final ‘Luck’ factor. In some competitions, the difference between the 3rd and the 4th place has been a mere 0.001%. So, if you aren’t ‘lucky’ the first time, don’t give up. It will be heartbreaking to discover that you ended up at a low rank in your first Kaggle competition. But keep participating in different competitions and keep learning. Read the latest and relevant literature on machine learning and keep your updated. Rectify your mistakes and start applying what you learn in your future competitions. 

  • Forming a good team



It’s critical to have passionate people on your team. So, switch on your radar and start searching for proper teammates. First ask yourself: What are the essential characteristics of a team member? Some of the general ones are a) They should support each other. b) They should learn from each other. c) They should know and be good at what they are doing. The chemistry shared among the team members can be the difference between winning and losing. Also, at times, look into the mirror and judge yourself: Are you a good team member yourself? If you find any flaws in your self-analysis, work on them. 

  • Don’t stress it

Machine learning can be quite exciting if you make it so. So, don’t start stressing out and make it a tedious task. Be passionate about learning more. Think of these competitions as a fun challenge. Don’t worry about getting a low rank – nobody is there to judge you. Don’t be too hard on yourself if you fail. Just dive in the competition and accept it as a wonderful experience where you can learn and make new friends.

  • Take it as a learning experience



You may not win your first Kaggle competition (unless you are a born genius in machine learning) nor your second one, but you can definitely learn something from participating in them. Kaggle competitions push you out of your comfort zone and make you experiment with your current knowledge. This expands your knowledge base and takes your skills to the next level. If you are stuck while practicing, don’t be ashamed to google out basic tricks and tips.

The two main things that will make you win the Kaggle competitions are: Persistence and constant learning. To furnish your skills and expertise in machine learning, you can also go for machine learning courses provided by CodingNinjas. So, learn from your failures without taking them to heart and give your best during the competition. Best of luck.

6 key factors that determine your success in competitive coding

Do you want to test out your coding skills? Then, competitive coding is the best way to go. Imagine you are in the competition – your body’s pumping in the blood to your brains and your fingers all jittery, tapping in the codes to win! Makes you almost feel like Neo, doesn’t it? Competitive coding is fantastic for coders – it puts you on the edge, pushes you out of your comfort zone and boosts your coding skills. But there are certain ways of approaching coding which can bring you success in coding competitions. Here are a few factors which you need to keep in mind when you are engaging with competitive coding: 

  1. Preparing the algorithms and data structures

download (4)


For efficient programming, you have to get your basics right. When you are in a competition, you have to code fast – but that should not be an excuse for shabbiness. One of the basics of coding is mastering the data structures and algorithms. So, get your college and high school books out, and start brushing up the basics of coding. You can always take the help of GeeksForGeeks for detailed tutorials too. For intensive coding course, you can also go for CodingNinjas competitive programming courses.

  1. Choose a language you are comfortable with 

The way towards any kind of success is to do what you love. Similarly, during coding competitions, you got to choose a language which you are comfortable with. Learn every bit of the language from the basics to the advanced skills necessary. Ensure that you put in much of your time and effort in this language and develop a mastery over it. Even if it’s C++, make sure that you know it inside out before you participate in a coding competition.    

  1. Practice makes perfect

The old adage – practice makes you perfect is even more relevant for coding. Coding is a skill that you build up on every time you code. Every second you put in to work on the skill brings you closer to achieving a level of mastery in it. Make a schedule if you want, and put in your undivided attention to practice coding during the coding hours. It will definitely give you an edge during the competition.

  1. Participate in more competitions



While practicing may give you the edge over other coders, your mind might mess up when you actually enter the competition. Facing your challenges, competing with different coders with the same goal – all these factor in to increase a lot of pressure on you. To get rid of it, you have to participate in more competitions. The more you participate, the better you become prepared to tackle the environment that you are in. This will eventually bring a positive difference in your fast-coding skills that is essential for such competitions.

  1. Patience

Leader Illustration


Even when you practice and participate in a number of coding competitions, it may not bring you instant victory. It takes time and yes, there is a bit of luck present. You have to be patient. Don’t give up – keep taking the shot – keep participating and keep improving your coding skills. One day, you will be holding the prize and look back in your struggles with pride.

  1. Keep it fun

Coding can often turn out to be really frustrating. It can take a toll on your mind. But don’t be too harsh on yourself. Look at the bright side. These competitions push you out of your comfort zone and that helps to give a new dimension to your coding. Plus, you get to know new coders who can help you out in the future too. So, always be positive and keep it simple. Keep the competition fun and healthy, and enjoy it completely. De-stress yourself and keep a cool mind while coding. That will bring you closer to the success you desire.

Keep the right mindset and you can really achieve what you desire. Remember the three Ns of Coding: Never give up, Never get stressed, and Never stop believing in yourself. Go, get your prize. Best of luck. 
Coding competitions become so much easier when you are actually practicing it in an environment designed for coding competitions. At CodingNinjas, we give you exactly that environment and try to push you out of your comfort zone to get to the top. Let our competitive programming course help you out with your dream to win coding competitions.

Must-know Python libraries for any aspiring Data Scientist

We are all aware of Python – the simple language that is currently defining the digital world. Pairing machine learning capabilities with simple coding, Python is a big hit among data scientists, along with the data science specific language, R. However, if you really wish to master Python and build your career as a data scientist, then you should know the most popular Python libraries. Python, because of its simplicity, offers a lot of libraries for different use-cases. And if you are someone who is looking to make your mark as a data scientist, not only should you familiarize yourself with Python but with these libraries:




NumPy is a great open source library which is mostly dedicated to numerics. It has some pre-compiled functions that make working with large multidimensional matrices and arrays easy. Even when you apply basic numerical standards, Numpy makes it so simple that you don’t have to write Loops like in C++. While it may not have an integrated data analysis facility, its array computing can be paired with other data analysis tools and make it easier.


pasted image 0 (5)


SciPy is a module in Python which provides fast N-dimensional array manipulation. It not only makes numerical routines easier but it can also help with numerical optimization and integration. It even has modules like linear algebra, optimization and integration – all important tools in data science.


pasted image 0 (6)


If you want to add visualization in your project, the Matplotlib is the best way to go. It can be used to quickly make pie charts, line diagrams, histograms or other professional visual items. You can even customize certain aspects of any specific figure. The best part, you can export the images into graphic formats like png, jpeg, pdf, etc.


pasted image 0 (7)


Since machine learning is the way of the future, Scikit-Learn is the machine learning module introduces to Python. It gives you a set of common machine learning algorithms providing it to you through a consistent interface. There are a lot of algorithms available in Scikit-Learn and it also comes handy with machine learning-based tasks like regression, clustering, etc.


pasted image 0 (8)


For data munging, the best Python module is Pandas. It has high-level data structures and the tools present here are best suited for faster data analyses. It is based on NumPy and so, NumPy can be used easily on it. 


pasted image 0 (9)


NLTK is one of the best programmes that can work with human language. It has a simple interface and more than 50 corpora and lexical resources like WordNet, which can be used for tokenization, tagging, parsing and many more. NLTK is so popular that it is often used to create prototypes of research systems.



Statsmodels tries to estimate different statistical models by exploring data and performing statistical tests. It has a list of different plotting functions and statistics based on results for each type of data. 

pasted image 0 (10)


Statsmodels tries to estimate different statistical models by exploring data and performing statistical tests. It has a list of different plotting functions and statistics based on results for each type of data. 


pasted image 0 (11)


Python-Based Reinforcement Learning, Artificial Intelligence, and Neural Network or PyBrain is for neural networks. It can be used for both unsupervised learning and reinforcement learning. If you want a tool for real-time analytics, this is the best way to go.


pasted image 0 (12)


Built on both Scipy and Numpy, the Gensim library is for topic modeling. From fast scalability of language to optimized math routine, this open source library will keep your delighted with its simple interface and platform independence.


pasted image 0 (13)


Almost like Numpy, Theano is a library that focuses on numeric computation. It allows evaluation and optimization of mathematical expressions which also involves efficient treatment of multi-dimensional arrays.

So, get your mind set and start your data science journey with some must-know Python libraries. To make sure your python game is strong, you can also look at some of the courses offered by Coding Ninjas. Have a look at our course on Machine Learning and Data science and set out on your journey to become a distinguished data scientist. Best of luck.


Step-by-step guide to execute Linear Regression in Python

As most of us already know, linear regression used to find correlation between two continuous variables. There are various ways of going about it, and various applications as well. In this post, we are going to explain the steps of executing linear regression in Python.

There are two kinds of supervised machine learning algorithms: Classification and Regression. Regression tries to predict the continuous value outputs while classification tries to predict discrete values. Here we will be using Python to execute Linear Regression. For this purpose,  Scikit-Learn will be used. Scikit-Learn is one of the most popular machine learning tools for Python.

First up – what is linear regressive theory?

A linear regressive theory is based on the principle of linearity between two or more variables. It’s task is to predict a dependable variable value, let’s say y, based on an independent variable, let’s say x. Hence, x becomes the input and y is the output. This relationship, when plotted on a graph, gives a straight line. Hence, we have to use the equation of a straight line for this, which is:


Where m is the slope of the line and b is the intercept. Here y and x remains the same and so, all the changes that takes place will be in the slope and the intercept. Thus, there can be multiple straight lines on that basis. What a linear regression algorithm does is it fits the multiple lines along the data points and then returns the line but with the least errors.

A regression model can be represented as:

y = b0 + m1b1 + m2b2 + m3b3 + … … mnbn

This is referred to as the hyperplane.

So, now, how can we use Scikit-Learn library to execute linear regression:  

Let’s say there are many flight delays that has taken place due to weather changes. To measure this fluctuation, you must perform linear regression with the data being provided. This data can include the variation of minimum and maximum temperatures for the particular days. Now, you can download the weather charts to understand the fluctuation. The input x will be the minimum temperature and using that, we have to find the maximum temperature y.

Import all the necessary libraries

import pandas as pd 

import numpy as np 

import matplotlib.pyplot as plt 

import seaborn as seabornInstance

from sklearn.model_selection import train_test_split

from sklearn.linear_model import LinearRegression

from sklearn import metrics

%matplotlib inline

Now check the data by exploring the number of rows and columns in the datasets


You will receive output in the form of (n rows, n columns)

For statistical display, use:


Now, try to plot the data points in the form of a 2-D graph to figure relationship just by glancing at the graph. We can do so by using:

dataset.plot(x=’MinTemp’, y=’MaxTemp’, style=’o’) 

plt.title(‘MinTemp vs MaxTemp’) 




linear regression in python


So, here we have used the MinTemp and MaxTemp for analysis. So, let’s use the Average Maximum Temperature between 25 and 35.




linear regression in python


Once we have done that, we have to divide the data in labels and attributes. Labels refer to the dependent variables which need to be predicted and attributes refer to the independent variables. Here we want to predict the MaxTemp by using the values of the MinTemp. Attribute should include “MinTemp” which is the X value and the label with have ‘MaxTemp’ which is Y value.

X = dataset[‘MinTemp’].values.reshape(-1,1)

y = dataset[‘MaxTemp’].values.reshape(-1,1)

Now we can assigned 80% of this data to the training set and the rest to the test set.

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0)

After this, we can train the data using the following:

regressor = LinearRegression() 

regressor.fit(X_train, y_train) #training the algorithm

We can find the best value for the slope and intercept so that you get the best fit for the data. We can do that with the following code:

#To retrieve the intercept:

print(regressor.intercept_)#For retrieving the slope:


With the algorithm trained, we can now use it to make some predictions of the MaxTemp. Our test data can be used for that. We use the following:

y_pred = regressor.predict(X_test)

After we find the predicted value, we have to match it with the actual output value.

We use this script for it:

df = pd.DataFrame({‘Actual’: y_test.flatten(), ‘Predicted’: y_pred.flatten()})


Now, there is a possibility that you will find huge variances between the predicted and actual outcome.

So, by taking the 25 of them, develop a bar graph, using this script:

df1 = df.head(25)


plt.grid(which=’major’, linestyle=’-‘, linewidth=’0.5′, color=’green’)

plt.grid(which=’minor’, linestyle=’:’, linewidth=’0.5′, color=’black’)


linear regression in python


In the bar graph, you can see how close the predictions are to the actual output. Now, plot it as a straight line.

plt.scatter(X_test, y_test,  color=’gray’)

plt.plot(X_test, y_pred, color=’red’, linewidth=2)


linear regression in python


The straight lines will indicate that the algorithm is correct.

Now, you have to examine the performance of the algorithm. This will use certain metrics:

  1. Mean Absolute Error (MAE) : This will calculate the mean absolute values of the errors. 
  1. Mean Squared Error (MSE): It calculates the mean of the squared errors.
  1. Root Mean Squared Error (RMSE) calculates the square root of the mean of the squared errors.

The Scikit-Learn library has a pre-built function which you can use to calculate this performance by using the following script.

print(‘Mean Absolute Error:’, metrics.mean_absolute_error(y_test, y_pred)) 

print(‘Mean Squared Error:’, metrics.mean_squared_error(y_test, y_pred)) 

print(‘Root Mean Squared Error:’, np.sqrt(metrics.mean_squared_error(y_test, y_pred)))

Multiple Linear Regression

linear regression in python


Now let’s imagine you have multiple data points to work with. This means, you have to use multiple linear regression. An example would be the use of alcohol – let’s say beer. When you consider something like beer and the quality of it, you have to take in various factors like sugar, chloride, pH level, alcohol, density, etc. These are the inputs that will help to determine the quality of the beer. 

So, as we did earlier, we will first import the libraries: 

import pandas as pd 

import numpy as np 

import matplotlib.pyplot as plt 

import seaborn as seabornInstance

from sklearn.model_selection import train_test_split

from sklearn.linear_model import LinearRegression

from sklearn import metrics

%matplotlib inline

Again, explore the rows and columns using:


Find the statistical data by using:


Now, we have to first clean up some of the data. We can use the following script:


All the columns should give False when you use this check, but if one of them turns out to be true, use this script:

dataset = dataset.fillna(method=’ffill’)

Next, we divide them into labels and attributes. 

X = dataset[[‘fixed acidity’, ‘volatile acidity’, ‘citric acid’, ‘residual sugar’, ‘chlorides’, ‘free sulfur dioxide’, ‘total sulfur dioxide’, ‘density’, ‘pH’, ‘sulphates’,’alcohol’]].values

y = dataset[‘quality’].values

linear regression in python


Find the average of the quality column




Separate 80% for training and 20% to test.

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0)

Train the specific model:

regressor = LinearRegression() 

regressor.fit(X_train, y_train)

Now, check the difference between predicted and actual values:

df = pd.DataFrame({‘Actual’: y_test, ‘Predicted’: y_pred})

df1 = df.head(25)

Plot it on a graph:


plt.grid(which=’major’, linestyle=’-‘, linewidth=’0.5′, color=’green’)

plt.grid(which=’minor’, linestyle=’:’, linewidth=’0.5′, color=’black’)


linear regression in python


If you find the predictions close to the actual one, then apply the following script:

print(‘Mean Absolute Error:’, metrics.mean_absolute_error(y_test, y_pred)) 

print(‘Mean Squared Error:’, metrics.mean_squared_error(y_test, y_pred)) 

print(‘Root Mean Squared Error:’, np.sqrt(metrics.mean_squared_error(y_test, y_pred)))

If you are facing any errors, it can be due to any of these factors:

  • Inadequate Data: The best prediction can be done with more data inputs.
  • Poor Assumptions: If you assume that you can have a linear relationship for data which may not have such a relationship, that will lead to an error.
  • Poor use of feature: If the features used does not have a high correlation with the predictions, then there can be errors.

So, this was a sample problem on how to perform linear progression in Python. Let’s hope you can ace your linear regressives using Python! If you’re looking to get your concepts of Machine learning and Python crystal clear, CodingNinjas might be able to help you out.

Interesting machine learning projects to tackle these summers

The heap of data that is created each day by every single person is only going to increase with time. This is precisely what facilitates the need for being equipped with Machine Learning and its best practices. Machine learning is the process where a gadget can improve itself from previous experiences just like a human being.

Seemingly, indulging into projects can be the best management of your time.

Practice on real projects always beats theory. While you explore your hands-on an interesting project, your Machine Learning skills will eventually level-up.

Putting the projects in your portfolio not only enhances it but it can even land your dream job. We are mentioning some of the interesting projects below on which you can work on these summers. And, if you find something interesting enough, working longer on them will make you a pro.

1. Machine Learning Gladiator: This is one of the most efficient ways to understand how Machine Learning works. The purpose is to implement the out of the box models into separate datasets. This particular project is beneficial for a few reasons:

First one of them would be, you get an idea of the model. You can find many solutions by digging deep in the textbooks but there are some queries which can only be resolved by performing practically. For instance, Which models are the best fit for categorical features? Which models are more likely to miss data?

Secondly, working on projects often prepare you with the skills of creating models at a faster pace. Based on textbook knowledge the process can be time-consuming.

Finally, building your own projects can help you master the flow. Suppose you have a lot on your plate like importing data, cleaning data, pre-processing, transformations and so on. But you have already honed the skill of building out-of-the-box datasets which will help you in further critical projects.

2. Predict House Prices: As the name suggests, this project will include models which will predict estate prices for buyers and sellers. The location and square footage are merely an aspect of the house. The price will include every logical feature and variable available.

Predictions will be made by evaluating the realistic data and accurate measures. This process includes:

– Analyzing the sales price (variables)

-Multivariable analysis

-Predictions & Modeling

-Impute Missing data

3. Twitter Sentiment Analysis: Sentiment Analysis widely means text mining. Using an advanced technique to analyze the sentiment of a sentence is known as Twitter Sentiment Analysis. To parse if the sentiment of the text is positive, negative or neutral with the help of data mining. We all have the idea that there is a massive amount of data out there. Exploring this project can also help you get an opinion of the masses in all sorts of tweets. Be it political, business strategy and public actions.

4. Teach a Neural network to Read Handwriting: Neural Networks is one of the greatest achievements in Machine Learning. The significant models developed include face recognition, automated cars, automatic text creation.

Apparently, Handwriting recognition can be critical for you. The best thing is, it doesn’t require any high computational power. Mastering this project will prepare you for further challenges.

5. Image Caption Generator: Generating a caption from a visual can be a challenge for Machine Learning beginners. It requires the computer to do both jobs which are creating a vision to understand the concept of the image and prepare a model to recite the language properly to frame an appropriate caption by order. There are methods introduced in deep learning through which you can create a model to describe the content of a given visual. This can be done without a properly designed model with sophisticated data.

These are some of the fun projects which you can work on these summers. Practice will make you smart enough to develop your own unique model someday. For further queries reach out to codingninjas.in and you can always discover more about Machine Learning