Posted on

5 Best IDE for Python Programmers

An integrated development environment (IDE) is a software suite that consolidates the basic tools developers need to write and test software. Typically, an IDE contains a code editor, a compiler or interpreter and a debugger that the developer accesses through a single graphical user interface (GUI). An IDE may be a standalone application, or it may be included as part of one or more existing and compatible applications. In this article we will know about the 5 best IDE (according to me) for Python Developers

1. VIM

VIM is one of the most advanced text editors and is very popular one among the community of Python developers. It is open source and available free of cost under GPL license. Vim though is best known as an editor but it offers nothing less than a full featured Python development environment when configured correctly for Python development. VIM is light weight, modular and fast and is best suited for programmers who love keyboards and only keyboards, no mouse use while coding.

 


2. Sublime Text 3 / Anaconda Python IDE

Sublime Text 3 is one of the most powerful cross platform lightweight code editors till date. With the use of plugins Sublime Text 3 can be used as a full featured IDE – the Sublime Python IDE. You get elegance of sublime text and powers of Python at one place to create your own magic. The most powerful transformation is brought to you by Anaconda package which provides code completion and linting for Python.

3. Pydev with Eclipse – Best Python IDE (Free Tier)

Pydev is the Python IDE for masses for the simple reason that it is free of cost and comes packed with powerful features for efficient Python programming. It is an open source plugin that runs on top of Eclipse and brings Python to the kingdom of Eclipse. If you are an existing Eclipse user then Pydev is just home for you, if not, then Eclipse might sound intimidating in the beginning but worth the efforts.

4. Emacs – Python Editor cum IDE

Emacs has an ecosystem of its own. It is the GNU text editor which is extensible and highly customizable. When it comes to Python programming, Emacs can be configured in such a way that it gets transformed into a fully functional free Python IDE.

5. Spyder Python

Spyder Python is an open source IDE for Python, best suited for scientific python development. It is a lightweight software, written in Python itself and available as free to use under MIT license. Some of the basic features of Spyder python are multi language editor, interactive console, documentation viewer, variable explorer, Find in files, files explorer etc. It can get Spyder IDE package for windows, Mac or Linux.

 

 

Posted on

Top 5 nodeJs framework for Developers

Node.js is one of the more groundbreaking additions to the web development landscape, offering an environment that enables full-stack JavaScript applications for the first time ever. Prior to Node.js, JavaScript was limited to client-side scripting, but Node transformed the script into a cross-over language, capable of writing software that’s portable between the front and back ends.

JavaScript brought its speed and cross-platform compatibility to back-end development, along with its devoted community of JavaScript programmers. In its 2015 developer survey, Stack Overflow found that JavaScript was the most popular programming language—even among back-end developers. This soaring popularity, along with Node’s expansion into an entire development ecosystem, has fueled the creation of numerous Node.js frameworks that both extend and add to Node.js’s existing features.

Node.js_logo

Let us look at the Node.js framework list representing most powerful and feature rich frameworks available today that help you build real time and scalable web applications with ease.

Express.js

Express.js a lightweight, efficient middleware and routing framework. Express.js is best known as another quarter of the MEAN (MongoDB, Express, AngularJS and Node) stack, and is the most popular Node.js framework. Because Node.js itself wasn’t intended to build websites, the Express framework is able to create an HTTP server in Node, layering in the middleware structure and response/request functions needed to actually run a site. It’s a pretty minimalist framework that’s great for giving developers extra, built-in web application features and the Express API without overriding the already robust, feature-packed Node.js platform. Note that it does require a bit more manual tasks, which can be tedious and time consuming, and has a bit larger footprint than other frameworks.

Socket.io

Socket.io is all about real-time communication and chat apps—the kind of software that hinges on robust event-driven, bidirectional communication between browsers and servers. It’s a websocket-compatible server that’s great at providing collaborative features and real-time analytics, whether they’re in the form of a counter or more in-depth metrics. Socket.io is compatible with every device, operating system, and browser. It’s been used by top tech companies like Trello, Zendesk, Microsoft, and Yammer, as well as Flightcar, a startup that lets people rent out their cars from the airport while they’re traveling.

Hapi.js

Need more enterprise-level functionality? Working with distributed engineering teams? Hapi.js may be the best route for you. Hapi.js was created by developers at Walmart in preparation for Black Friday traffic as an answer to limitations they’d run into with Express—mainly extensibility and maintainability issues. They found that, as the application grew, Express code was more difficult to split into chunks and delegate to different teams. Hapi’s plug-in system enables it to be worked on in sections without breaking the rest of the code base.

Right out of the box, Hapi does a lot more than Express. While there are similarities and differences between the two frameworks, Hapi—which is primarily used for rapidly building and testing application programming interfaces (APIs)—generally enables developers to focus more on writing reusable application logic instead of spending time building infrastructure. It supports API development with an array of plug-ins from authorization and authentication to metrics and logging. It’s been used by heavy-hitters like OpenTable, Macy’s, Condé Nast, and Disney.

Mean.io

Mean.js and Mean.io are frameworks written by the same author with subtle differences. Mean.io was developed first, so it has a bit more documentation and a larger community behind it. It’s based on Node modules, with client- and server-side files in separate modules. Mean.js uses an MVC-style Express/Node back end and an AngularJS-based front end. It also leverages the Grunt tool to enable automated testing.

Mojito

Mojito is an MVC framework based on Yahoo! Cocktails, a JavaScript-based mobile development platform built by developers in house at Yahoo!. Mojito acts like a module that layers very well with other core Node modules, while implementing Cocktails’ on-line/off-line, multi-device, hosted application platform.

 

Posted on

Use Python to get more than 0.75 accuracy in Titanic problem by Kaggle

Ship_image
The sinking of the RMS Titanic is one of the most infamous shipwrecks in history. On April 15, 1912, during her maiden voyage, the Titanic sank after colliding with an iceberg, killing 1502 out of 2224 passengers and crew. This sensational tragedy shocked the international community and led to better safety regulations for ships. One of the reasons that the shipwreck led to such loss of life was that there were not enough lifeboats for the passengers and crew. Although there was some element of luck involved in surviving the sinking, some groups of people were more likely to survive than others, such as women, children, and the upper-class.

The problem statement was to complete the analysis of what sorts of people were likely to survive and apply the machine learning tools to predict which passengers survived the tragedy. The Kaggle Titanic problem page can be found here. The full solution in python can be found here on github. The data in the problem is given in two CSV files, test.csv and train.csv. The variable used in the data and their description are as follows

Variable Name Definition
survival If an individual survived the tragedy or not
pclass Ticket class
Name Name of the individual
sex Sex
Age Age in years
sibsp # of siblings/spouses aboard the Titanic
parch # of parents/children aboard the Titanic
ticket Ticket Number
fare Passenger fare
cabin Cabin Number
embarked Port of Embarkation

The target variable here is Survived which takes the value 0 or 1. Since the target value takes the binary values we can say that the this is an example of classification problem. We have to train the model using train.csv and predict the outcomes using test.csv and submit the predictions on kaggle. At first we will read the data from CSV file using the pandas library in python, for that we have to import pandas library. The data is loaded in pandas dataframe format. We can see how the data looks like using dataframe.head() command. We can also see the columns using dataframe.columns command. We can check the number of rows and columns of the dataframe using the dataframe.shape command.

import pandas as pd
dataframe=pd.read_csv('train.csv')
print(dataframe.head(10))
print(dataframe.columns)
print(dataframe.shape)

The ‘Name’ variable present here contains the full name of the person. In this format the ‘Name’ variable is not useful for us as almost all the entries here will be unique and that would not help in our prediction. We can make this useful by trimming and partitioning the string to get the title and first name of the individual.

dataframe['Name']=dataframe['Name'].str.partition(',')[2]
dataframe['Name']=dataframe['Name'].str.partition(',')[0]

We can check the values taken by a variable by values_count() function. We can also check whether a variable contains NaN(Not a Number) values or not. After checking value_counts for age variable we found out that the age variable contained NaN values. We can wither drop the NaN values using dropna() function or we can impute the values. In this example we will impute the missing values using MICE(Multiple Imputation by Chained Equations). To use MICE function we have to import a python library called ‘fancyimpute’. Mice uses the other variables to impute the missing values and iterate it till the value converges such that our imputed value balances the bias and variance of that variable.

print(dataframe['Age'].value_counts(dropna=False)
from fancyimpute import MICE
solver=MICE()
Imputed_dataframe=solver.complete(dataframe.values)

Since this is a classification problem we can solve it by methods such as Logistic Regression, Decision Tree, Random Forest etc. Here we will use Random Forest to solve this problem. Variables present here are categorical and continuous. Some of the categorical variables are in the string format. So we have to first change that in the integer categorical format so that we can feed the data directly for our model to learn. We can use factorize function from pandas library to do this.

cols=['Name','Ticket','Pclass','Fare','Embarked','Cabin']
for x in cols:
    a=pd.factorize(dataframe[x])
    dataframe[x]=a[0]

We can create an addition variable named ‘family_size’ using the variables ‘parch’ and ‘sibsp’. Now our data is ready and we can train our model using the data. We will first divide the data into target variables and and features as Y and X. We will train the model using X and Y.

dataframe['family_size']=dataframe['SibSp'] + dataframe['Parch'] + 1
y=dataframe[['Survived']].values
x=dataframe.values
import numpy as np
x=np.delete(dataframe,0,axis=1)
model=RandomForestClassifier(n_estimators=100,criterion='gini',max_depth=10,min_samples_split=10)
model=model.fit(x,y)

Now our model has been trained. We can use this model to predict whether a person survived the tragedy or not. Now we will read the test.csv file and use the variables present as test features for prediction.

test=pd.read_csv('test.csv')
test['Name']=test['Name'].str.partition(',')[2]
test['Name']=test['Name'].str.partition('.')[0]
cols=['Name','Ticket','Pclass','Fare','Embarked','Cabin']
for x in cols:
    a=pd.factorize(test[x])
    test[x]=a[0]
test_features=test.values
my_prediction = model.predict(test_features)

Now we have our predictions in ‘my_prediction’ variable. Now we are ready to submit the solution to kaggle. For kaggle submission a specific format is given for problems. We will write our solution in a CSV file in suitable format which we can submit at kaggle.

PassengerId =np.array(test["PassengerId"]).astype(int)
my_solution = pd.DataFrame(my_prediction, PassengerId, columns = ["Survived"])
my_solution.to_csv("my_solution.csv", index_label = ["PassengerId"])

Now we have our solution in a CSV file ‘my_solution.csv’. We can submit this file on to kaggle submission page and check our accuracy.

 

 

Posted on

Node-RED for Internet of Things

Node RED

Node-RED is a programming tool developed by IBM for wiring together hardware devices, APIs and online services in new and interesting ways.

It is built on Node.js, taking full advantage of its event-driven, non-blocking model. This makes it ideal to run at the edge of the network on low-cost hardware such as the Raspberry Pi as well as in the cloud.

It provides a browser-based editor that makes it easy to wire together flows using the wide range of nodes in the palette that can be deployed to its runtime in a single-click.
Features

  • Browser-based flow editing
  • Built on Node.js
  • Social Development

Node-RED Comes along with the Bluemix IOT Starter Application. Adding IoT Foundation Service with Bluemix allows to use Node-RED. You can use the incoming and outgoing MQTT nodes in your flows. Most of them use Node-RED to define flows where either incoming sensor data from ‘things’ is handled, e.g. stored in databases, or where commands are sent to devices.

GitHub Link: https://github.com/node-red/node-red

Posted on

Google announced a private beta of their Google IoT Core platform

In a recent blog post, Google announced a private beta of their Google IoT Core platform. Cloud IoT Core makes it easy to securely connect your globally distributed devices to GCP, centrally manage them and build rich applications by integrating with their data analytics services. Furthermore, all data ingestion, scalability, availability and performance needs are automatically managed for you in GCP style.
When used as part of a broader Google Cloud IoT solution, Cloud IoT Core gives you access to new operational insights that can help your business react to and optimize for change in real time. This advantage has value across multiple industries; for example:

 

  • Utilities can monitor, analyze and predict consumer energy usage in real time
  • Transportation and logistics firms can proactively stage the right vehicles/vessels/aircraft in the right places at the right times
  • Oil, gas and manufacturing companies can enable intelligent scheduling of equipment maintenance to maximize production and minimize downtime

So, why is this the right time for Cloud IoT Core?

About all the things

Many enterprises that rely on industrial devices such as sensors, conveyor belts, farming equipment, medical equipment and pumps — particularly, globally distributed ones — are struggling to monitor and manage those devices for several reasons:

  • Operational cost and complexity: The overhead of managing the deployment, maintenance and upgrades for exponentially increasing devices is stifling. And even with a custom solution in place, the resource investments required for necessary IT infrastructure are significant.
  • Patchwork security: Ensuring world-class, end-to-end security for globally distributed devices is out of reach — or at least not a core competency — for most organizations.
  • Data fragmentation: Despite the fact that machine-generated data is now an important data source for making good business decisions, the massive amount of data generated by these devices is often stored in silos with a short expiration date, and hence never reaches downstream analytic systems (nor decision makers).

Cloud IoT Core is designed to help resolve these problems by removing risk, complexity and data silos from the device monitoring and management process. Instead, it offers you the ability to more securely connect and manage all your devices as a single global system. Through a single pane of glass you can ingest data generated by all those devices into a responsive data pipeline — and, when combined with other Cloud IoT services, analyze and react to that data in real time.

GCP

Key features and benefits

Several key Cloud IoT Core features help you meet these goals, including:

  • Fast and easy setup and management: Cloud IoT Core lets you connect up to millions of globally dispersed devices into a single system with smooth and even data ingestion ensured under any condition. Devices are registered to your service quickly and easily via the industry-standard MQTT protocol. For Android Things-based devices, firmware updates can be automatic.
  • Security out-of-the-box: Secure all device data via industry-standard security protocols. (Combine Cloud IoT Core with Android Things for device operating-system security, as well.) Apply Google Cloud IAM roles to devices to control user access in a fine-grained way.
  • Native integration with analytic services: Ingest all your IoT data so you can manage it as a single system and then easily connect it to our native analytic services (including Google Cloud Dataflow, Google BigQuery and Google Cloud Machine Learning Engine) and partner BI solutions (such as Looker, Qlik, Tableau and Zoomdata). Pinpoint potential problems and uncover solutions using interactive data visualizations, or build rich machine-learning models that reflect how your business works.
  • Auto-managed infrastructure: All this in the form of a fully-managed, pay-as-you-go GCP service, with no infrastructure for you to deploy, scale or manage.

iot-core-2