Code effortlessly
A python class gives us structure for creating a new entity in python with methods associated with it.
Default data types in python such string, list etc. all are classes (check builtins.py).
Let us look go through some examples to clear our understanding:
class A:
age = 4
def get_age(self):
print(A.age)
In the above example we have defined a class A and associated variable ‘age’ and method ‘get_age’ to it. Notice inside get_age method we are calling value of age as A.age which is because of the scope of variable.
# Create an instance of…
Code effortlessly
This post is regarding loops and basic functions in python. Any python programmer should be aware of these concepts.
There is difference between solving a use case and solving it with an elegant code. The word elegant here refers to a code which is simple, less number of lines, properly structured and has high maintainability. The concepts discussed in this post will help you achieve just that.
Code effortlessly
While solving a use-case we often encounter a need to read some data from a file or to save an output to a file (Basic Input and Output Operations). Various file formats have their own specific nuances.
Without further ado, let us dive into the pythonic pool and learn how to read and write various file formats.
a. Reading a text file :- Text file(.txt) is the most common file format available. We can load a text file into python memory in the following ways:
Code effortlessly
Before you start learning basic operations you need to realize that python has its own style. Many coders find the indentation style of python very uneasy because their eyes try to find the curly braces ‘{}’ or semi colon ‘;’ at the end of the command or statement.
If you are not aware of Pycharm Editor you can through this article.
Let us get started:
2. Since python is an interpreted language we can add two number with ease in the console.
Code effortlessly
When it comes to programming you need an integrated development environment (IDE) to code, structure,re-structure, debug etc. These softwares help us to minimize the coding effort. There are many IDEs for Python like Jupyter, Spider, Pycharm, VSCode etc. In this tutorial will focus on PyCharm IDE.
2. Once the download completes, open the executable file, you will see the below window. …
Code effortlessly
If you are reading this I am sure you have made up your mind to try the power of Python and use it to solve your use-case(s). In this tutorial and in those to follow you will see simple but effective examples to get you started with this language.
The main motto of the tutorial is to provide key elements necessary to begin your python journey and not to bombard you with all the heavy concepts at once.
Mathematics behind
Prerequisites:
1. Some knowledge of vectors and linear algebra.
2. Lagrange Multipliers
3. Analytical and learning attitude
Analogy:
The main concept or intuition behind SVM is to find the widest separation between two classes, here red and green dots.
Let ‘m’ be a hyper-plane separating the two classes and ‘w’ be a vector which is perpendicular to the hyper-plane. ‘xr’ be a vector representing the one of the red sample, let us say red sample in the above picture. ‘xg’ be a vector representing the one of the green sample, let us say red sample in the above…