Why do we need feature scaling in Machine Learning and how to do it using SciKit Learn?Data Science by Sunny Srinidhi - July 27, 2018November 5, 20191 When you're working with a learning model, it is important to scale the features to a range which is centered around zero. This is done so that the variance of the features are in the same range. If a feature's variance is orders of magnitude more than the variance of other features, that particular feature might dominate other features in the dataset, which is not something we want happening in our model. The aim here is to to achieve Gaussian with zero mean and unit variance. There are many ways of doing this, two most popular are standardisation and normalisation. No matter which method you choose, the SciKit Learn library provides a class to easily scale our data. We can use the StandardScaler
How to split your dataset to train and test datasets using SciKit LearnData Science by Sunny Srinidhi - July 27, 2018November 5, 20192 When you're working on a model and want to train it, you obviously have a dataset. But after training, we have to test the model on some test dataset. For this, you'll a dataset which is different from the training set you used earlier. But it might not always be possible to have so much data during the development phase. In such cases, the obviously solution is to split the dataset you have into two sets, one for training and the other for testing; and you do this before you start training your model. But the question is, how do you split the data? You can't possibly manually split the dataset into two. And you also have to make sure you split
Handle missing data in your training dataset with SciKit ImputerData Science by Sunny Srinidhi - July 27, 2018November 5, 20192 Most often than not, you'll encounter a dataset in your data science projects where you'll have missing data in at least one column. In some cases, you can just ignore that row by taking it out of the dataset. But that'll not be the case always. Sometimes, that row would be crucial for the training, maybe because the dataset itself is very small and you can't afford to lose any row, or maybe it holds some important data, or for some other reason. When this is the case, a very important question to answer is, how do you fill in the blanks? There are many approaches to solving this problem, and one of them is using SciKit's Imputer class. If you're
Label Encoder vs. One Hot Encoder in Machine LearningData ScienceTech by Sunny Srinidhi - July 27, 2018November 6, 201911 Update: SciKit has a new library called the ColumnTransformer which has replaced LabelEncoding. You can check out this updated post about ColumnTransformer to know more. If you're new to Machine Learning, you might get confused between these two - Label Encoder and One Hot Encoder. These two encoders are parts of the SciKit Learn library in Python, and they are used to convert categorical data, or text data, into numbers, which our predictive models can better understand. Today, let's understand the difference between the two with a simple example. Label Encoding To begin with, you can find the SciKit Learn documentation for Label Encoder here. Now, let's consider the following data: In this example, the first column is the country column, which is all
What’s the difference between JSON and JavaScript object?Tech by Sunny Srinidhi - August 1, 2017March 18, 20200 Most often than you think, people confuse JSON with JavaScript objects. But are they same? Let’s see in this post.
Hide properties of Mongoose objects in Node.JS JSON responsesTech by Sunny Srinidhi - July 19, 2017July 19, 20170 Many a times, we'll encounter a situation where we'll have to hide certain properties of Mongoose objects, especially when we're sending those objects in responses. For example, suppose you have an API endpoint like so: /user/:id. You will, obviously, send a user object as a response to this request. But there will be certain properties of the User schema (such as password) which you'd want to remove before sending the object in the response. Laravel developers can relate this to the $hidden array in Eloquent models, which automatically hides the given list of properties before sending the object in the response. There is no out-of-the-box solution for this in Mongoose. But it's pretty easy to achieve, even though it's a bit verbose.
How to install ScalaTech by Sunny Srinidhi - June 8, 20170 The first question to ask is, what is Scala? Scala is an object-oriented, general purpose programming language, which is also functional. Scala also supports static typing. Scala was designed to give a simple interface for functional programming while addressing the criticism aimed at Java. The code written in Scala is compiled to Java bytecode, which then runs on JVM. So Scala and Java are interoperable. On the other hand, Scala offers some of the best known features of functional programming, including currying, type inference, immutability, and pattern matching. Higher-order types in Scala is also pretty awesome. People who have Java knowledge and have worked on other programming languages, such as PHP and NodeJS, would love to know that Scala has the best
Auto-discovery of packages in Laravel 5.5Tech by Sunny Srinidhi - June 2, 20171 Laravel 5.5 is right around the corner, and there are quite a few amazing features coming with this new version. Taylor Otwell has been writing about the framework's new features frequently. The latest feature that he has announced is the auto-discovery of packages, their service providers, and facade aliases. This means, starting Laravel 5.5, we'll not have to manually copy-paste anything to the providers and the aliases array in app.php in the config folder. So, if a package you're installing via composer has the required configuration in it's composer.json file, the framework will automatically register any providers and aliases provided by the package. Taylor Otwell also mentioned that he has already sent a pull request to the Laravel Debugbar package by Barry
Laravel’s new migrate:fresh commandTech by Sunny Srinidhi - April 12, 2017April 12, 20170 One of the features in Laravel, because of which I fell in love with the framework initially, is migrations. I don't remember how most other frameworks handle migrations, but Laravel's migration engine is super awesome. If you work with Laravel regularly, you'd have no doubt used a few migration commands, maybe for creating a migration file, running migrations, rolling back migrations, etc. During development, it's not uncommon to run into situations where you break your DB schema and wanting to start from scratch, you know, a blank DB. Laravel makes this super easy with the migrate:refresh command. When you run this command against your database, the tool runs the down() function in all your migration files, thereby going back in time
Track Custom Events with Google AnalyticsTech by Sunny Srinidhi - April 11, 2017April 11, 20170 You've probably heard of Google Analytics before. We all use the tool to track various things on our websites. The tool provides information such as the location of users, page views, the kind of devices and browsers used by those users, the age group, and a lot more. But what if you want to track certain events which are specific to your website? Say you want to track how many people filled a form, or how many people clicked a link on your website? Google Analytics provides an unbelievably simple way to track these custom events. It's actually just one line of code to track such events. Let's see how you'd do just this. When you create a Google Analytics account, the tool