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
Understanding PHP VariablesTech by Sunny Srinidhi - April 5, 2017April 5, 20170 If you know PHP, you know that it's written in C. If you know C, you also know that it's statically typed. What does this mean? This means that you need to declare the type of a variable when you are declaring the variable. This is how you declare a variable in C: int a = 0; And this is how you do the same in PHP: $a = 0; So how does PHP know that $a is an integer and not a string? Or any other type? How does PHP convert this dynamic typing into static typing for the underlying C code? To understand this, you need to understand how PHP handles variables in it's code. And that's what we are going to
Create an animated GIF of your screencast on LinuxTech by Sunny Srinidhi - March 13, 20170 Animated GIFs of screencasts are everywhere today. How do you go from taking a screenshot of your desktop with the "Print Screen" button and recording a video of your desktop to creating an animated GIFs of your screencast to share on the internet? It's actually easier than you think. I'm going to tell you how to do it on a Linux machine, specifically Ubuntu, because I use an Ubuntu machine. The commands here are for Ubuntu, but they can very easily be ported to other *nix machines as well. First, you'll need to install a few tools: ImageMagick, MPlayer, and RecordMyDesktop. We'll be using RecordMyDesktop to record the activities on your screen or a portion of your screen as a video
Use Config Caching to Speed Up Your Laravel AppTech by Sunny Srinidhi - March 13, 2017March 13, 20170 As web developers, we're always looking for ways to speed up our app. It's all about milliseconds today. There are several ways by which a web app or a web service could be optimised for speed. Being one of the most used and popular PHP frameworks, Laravel has a few tricks up its sleeves to make this happen. One of them is config caching. Obviously, this is not going to make tremendous improvement, but significant enough to be written about. So what is config caching? Well, it's exactly what it sounds like, you cache all your configuration so that you don't have to go looking for it every time you want to read a configuration. Laravel, as usual, has an artisan command