Alexandra Steele Age Height Weight Family


Alexandra Steele Photo
Alexandra Steele

Alexandra Steele is the perfect example of beauty with the brain. This elegant yet beautiful lady is ruling over the casting desk of the top American channels like CNN, WJLA, and such for decades now. Classy acting, appealing appearance, and interactive presentation helped Steele gather a massive audience base quickly. But, Alexandra Steele kept her life secret as an FBI agent’s dossier. Let us get a quick brief on the information we could gather about this charismatic personality.

Alexandra Steele HD Wallpaper

Personal Information

Full Name: Alexandra Steele
Nick Name: Alexandra
Date of birth: February 17, 1969
Age Now: 52 years ( as in 2021) 
Place of birth: Albany, New York, United States of America
Current residence: Washington, United States of America
Nationality: American 
American flag
Occupation: News reporter( weather forecast). 
Meteorologist.
Political view:  Not revealed
Religious view: Christianity
Zodiac sign:  Aquarius

Physical Stats

Height: In feet: 5 feet 7 inches 
In meters: 1.73 meters
In centimeters: 173 centimeters
Weight: In Kilogram: 58 kg
In Pounds: 127 lbs
Bust size: 32B
Waist size: 28 inches
Hip size: 36 inches
Measurement: 32-28-36 inches
Body type: Hourglass
Hourglass Body Shape
Eye color: Brown 
Skin color: Caucasian
Hair color: Blonde
Dress size:  6 ( USA standard) 
Shoe size:  8 ( USA standard) 
Alexandra Steele Image

Family History

Alexandra Steele is quite successful in keeping her personal life private. We have very little information regarding her Early childhood, Paternal family, education, and such.

Father’s name: Jamie Combs 
Mother’s name:  Nina Darrington
Siblings: Not revealed
Brother: Not revealed
Sister: Not revealed
Pet: Not revealed

Personal life

Marital status: Never married
Date of marriage: Not available
Date of divorce: Not available
Husband’s name: Not available
Boyfriend (s): Jim Canton ( rumored) 
Children : One 
Daughter: Not revealed
Son: None 

Educational Background

Unlike some American stars, Alexandra Steele made her ground on humor and knowledge. Her long list of graduation degrees clear the idea of hard work and passion can make you a person worth cherishing.

School: Albany local school
College: Albany local college
University: Degree in meteorology.
Degree in hydrology.
Degree in thermodynamics.
All from the United States of America. But, the specific university or faculty is not revealed by Steele or her family. 

Career Graph

After graduating with a degree in meteorology, Alexandra steel appeared first on the WJLA as a meteorologist. Steele’s first break was joining the weather channel on the weather forecast section. It is an ABC channel affiliate show. In 2019, the collaboration with Jim Cantore brought her worldwide fame. The couple showed flourishing chemistry and humor that made the weather show a massive hit. Rumors also started to come out regarding the couple.

Alexandra Steele Wallpaper

It is a rumor that Alexandra joined CNN in 2014 to avoid further talks and embarrassment. But, she came back to the Washington weather channel shortly after. She worked with CNN for four years.

Hosting

Primetime Live.
Good morning America.
Weather forecast.

Net Worth

Pay per hour: Between 11 to 31 dollars. 
Pay per year: more than 85 thousand dollars. The exact amount is unknown. 
Net value:  One million USD 

Social Media Profiles

Alexandra Steele is a private person and does not like to socialize on social media platforms much. The reporter did not have a Twitter account up until 2019. Currently, Alexandra Steele is available on Twitter and following 19 people altogether.

Profiles: Flowers:
Facebook: No verified account
Instagram: No verified account
YouTube: No verified account
Twitter: 441 follower

Favorite personality’s favorite

Favorite food(s): Burger.
Pizza.
Favorite holiday destination: Paris.
Favorite hobby (s):  Traveling.
Shopping.
Favorite timepass: Reading.

 Facts about Alexandra Steele

  • Alexandra is a nonsmoker but, An occasional alcohol drinker. 
  • After the Jim Cantore rumors, both Alexandra Steele and Jim Cantore left the show. Stephanie Abrams and Mike Bettes took over the front and still running it successfully. 
Alexandra Steele HD Photo

Controversy

Being extremely introverted regarding her personal life could not save Alexandra Steele from controversial issues ultimately. Here is an event from 2012.

  • Alexandra Steele was the most popular host back in 2012 when she reported that the Lions of San Diego & the Los Angeles Chargers had a friendly football match in Detroit on January 4, 2012. The news came out to be a bluff. Both the teams were not present on the issued date on the Detroit City. Fans went crazy. But, surprisingly, fans did not bash Alexandra Steele for the mistake. Instead, people started claiming it was on the side of the news collectors and editor’s error. It shows the massive popularity and trust of people in Alexandra Steele. 
Alexandra Steele HD Picture
  • Some people believe that Alexandra Steele was having a romantic relationship with co-host Jim Cantore from the weather channel. Jim Cantore divorced his wife (Tamara Cantore), who was suffering from degenerative Parkinson’s disease. Rumors say that Jim Cantore withdrew from his kid’s ( Christina Cantore and Ben Cantore) responsibilities. Both of his kids are suffering from fragile X syndrome. Fragile X syndrome is a rare genetic condition. The incident grew general discomfort for Jim Cantore back then. But, neither Jim nor Alexandra cleared out anything in public. 
  • Alexandra was raising a girl infant back in 2008. Rumors say that Jim Cantore is the father of her child. Alexandra took a leave from work around that time and returned with her child, which creates a strong point for the fans. Steele did not clear out anything regarding her daughter’s birthday, father, or other information like her life’s different sectors. 
Alexandra Steele Picture

There are very few women in the entertainment industry who made their place with pure knowledge, classic humor, and no controversy. Alexandra Steele is one of them. Indeed, some events became prominent due to her public image and fan’s concern. Other than these, Alexandra Steele proved herself to be a lady of honor with a body of an early twenties girl.

If you are interested in learning more about Americans you can check our list of Americans. Thank you!



Source link

With Formula and Excel Functions


It is often used when you want to find the central position of the data in a dataset. Mean. Mode and Median are using in the measurement of the central position for a set of data. Measurement of Central Tendencies may be affected by the outliers, you will know more in details here. If you already know the measurement of Central Tendency, then you can read measurement of Dispersion an up gradation of Measurement of Central Tendency.

In the measurement of Central Tendency, we measure data using mean, Mode and Median. Let’s know each of them in details.

Mean (Average)

It is also called as the calculated average of a dataset.  You can say it is the most frequent use measurement of central tendency. In addition, It uses in both continuous and discreet dataset.  It is the sum of all the values in a data set divided by the total number of values in a dataset. Mean can change if we add new or remove value. It can also be changed if we add the large value to the data. The formulae for calculating the mean in mathematics is:

Sample Mean formula
Sample Mean formula

How to calculate Mean in Excel?

In excel you can use the following function to find the mean or Average.

= AVERAGE(value1[value2, ...])

The Value2 is optional.  It will calculate the Mean of all the selected values in the dataset.

Mean of the Dataset
Mean

You can see in the above figure I am using the =Average(B2: B11) for calculating the mean of the values in Column B and it’s 90.7. If I will add a large value to the data then mean will also increase.

Where you can use Mean in Real Life?

Sports – Player Average Score.

Academics – Average Marks of the student.

Stock Markets – Moving Average, Exponential, Simple and Weighted Moving Average.

Median

You can say median as the middle value in a given dataset. Data values must be sorted for calculating the mean. If the values are random, then you have to first order it in ascending order to find the median. The formulae for the median is different in case of odd and even value. The formulas for the median is given below.

Cases:

Number of values is Odd

In this case, median is the value at the (n+1 )/2.

Number of values  is Even

Then the mean will be average of the values at (n/2) and (n+1)/2.

How to calculate the Median in Excel?

You can use the MEDIAN(value1[value2, …]) function for calculating the mean. The value2 is optional. For example, in the below figure I used the function =MEDIAN(B2: B11) for finding the median of the dataset.

Median of the data
Median

Where you can use Median in Real Life?

Economics: Household Income of a Country.

Academics: Student Placement Packages

Real Estate: Price of a House

Stock Market – Median Price to Earning Ratio, P/E.

Mode

It is the most frequent occurrence of a value in a dataset. On a Histogram, Mode is the highest bar in a bar chart or Histogram.

How to calculate the Mode in Excel?

You can easily calculate mode in the excel using the function = MODE(value1[value2, …]. The value2 is optional. Like in the below figure, I am using =MODE(B2: B11) and the Mode of the Data is 120. that is the most occurrences of the number.

Mode of the Data
Mode

Where you can use Mode in Real Life?

E-commerce- Mostly sale items

Stock Market – Price Level,( Finding the most occurrence of a Price of a stock market. )

When to use Mean, Median and Mode?

If you have a dataset and are confused where to use median, mode in data variable then consider the following table. Nominal, Ordinal, Interval and Ratio are all level of measurements.

Type of Variable Best measure of central tendency
Nominal Mode
Ordinal Median
Interval/Ratio (not skewed) Mean
Interval/Ratio (skewed) Median

What is  the use of Central Tendency in Machine Learning

There is a use case of central tendency in Machine learning. For example, you can use the mean with standard deviation to scale the dataset from 0 to 1.  Sklearn provided a standard scaling function to scale the dataset. Scaling in Machine learning is a must as it allows you to build the best model. Its because all the values of the dataset are in the range 0 to 1 and it can easily fit the dataset in the Model Function.

Conclusion

Measurement of Central Tendency is mainly affected by the presence of outliers. And also it doesn’t tell the relationship between the central positions and the remaining data as compared to measurement of dispersion. In all the measurements you will mostly use Median and Mean in Statistics like for finding Standard Deviation, Hypothetical Testing e.t.c.  I hope you understood what is Measurement of Central Tendency and how to calculate mean mode and median. Also where to use all these in real life.

If you like our post, then  [mpp_popup id=”1386″] Subscribe us [/mpp_popup] and Like our Dedicated Facebook Page Data Science Learner.

 

Thanks

Data Science Learner Team

Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for signup. A Confirmation Email has been sent to your Email Address.

Something went wrong.





Source link

How to Handle Outliers in Data Analysis ? Multivariate Outlier Detection


When you have a large dataset then there are the various cases when you are not getting the accurate machine learning models. Their predictions accuracy are not correct as you expected. There can be various reasons for it like Duplicates values e.t.c. One of the other reasons is Outliers. These are the values that don’t contribute to the prediction but mainly affect the other descriptive statistic values like mean, median, e.t..c. In this tutorial of “How to“, you will know how to find the handle outliers and do outlier analysis on the MultiVariant Data. (More than one variable or features). You will know.

  1. How to handle outliers using the Box Plot Method?
  2. Finding the outliers using the Scatter Plot Matrices.

First of all detecting, the outliers import all the necessary libraries for this purpose. I am writing all the code in the Jupyter notebook, therefore make sure to follow the same process with me for more understanding.

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from pylab import rcParams
import seaborn as sb
%matplotlib inline
rcParams["figure.figsize"] =10,6

About the Dataset.

For the demonstration purpose, I am using the Iris dataset. It has 5 columns with the 4 columns as the variable (feature) and the last column(species) is the target. These columns are sepal length, sepal width, petal length, petal width, species.

Lets read the dataset and define the data and the target for this dataset.

iris_data = pd.read_csv("data/iris.data.csv",header=None,sep=",")
iris_data.columns = ["sepal length","sepal width","petal length","petal width", "species" ]
data= iris_data.iloc[:,0:4].values # read the values of the first 4 columns
target= iris_data.iloc[:,4].values # read the values of last column
iris_data[:5]

read the Iris Data

In the third and fourth line, we selected the data and the target. In the data, you will choose the values of all the four columns sepal length, sepal width, petal length, petal width and for the target, you choose the species column.

How to handle outliers using the Box Plot Method?

There is a term in the box plot that is an interquartile range that is used to find the outliers in the dataset. I am not here going on the details about it. For more reading about it then you can check the Measurement of Dispersion post. It covers how to find the Interquartile range and fence.

Visualizing the best way to know anything. For seeing the outliers in the Iris dataset use the following code.

sb.boxplot(x="species",y ="sepal length",data=iris_data,palette="hls")

In the x-axis, you use the species type and the y-axis the length of the sepal length. In this case, you will find the type of the species verginica that have outliers when you consider the sepal length. You can clearly see the dot point on the species virginica.

Finding the outliers using the Scatter Plot Matrices

In the above case, we used the matplot library for finding the box plot. But in this case, I will use the Seaborn for finding the outliers using the scatter plot. The following figure will give the pair plot according to the species.

sb.pairplot(iris_data,hue="species",palette="hls")

 

scatter plot on the multivariant data

Inside the pairplot() method you will pass the 1st argument as data frame (iris_data), hue (species)  for specifying the columns for labeling and palette “hls”. In the above figure, you can see the odd redpoint that doesn’t fit any of the clusters. The species in setosa , Note that point and remove the records from the excel. Here the record is at the cell 41. Delete that.

Using z-Score –

It is very simple process for outliers. All you need to calculate the z-score of the data points. It is Standard normal distribution where mean =0 and standard deviation is 1. You need to discard the elements which has standard distribution greater than 3 or  lesser than -3.

Conclusion

Finding outliers is an important task for data pre-processing. If there are outliers then your machine learning prediction will be not accurate. Therefore if you have a large dataset, then always make sure that the percentage of the outliers should be less than 5%.

Hope this tutorial has given you a clear understanding of how to Handle Outliers on the MultiVariant Data If you any question about dealing with data, then please contact us. You can also like our page for more “How to” tutorial.

Thanks 

Data Science Learner Team

 

Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for signup. A Confirmation Email has been sent to your Email Address.

Something went wrong.





Source link

With Formula and Excel Functions


You can say the measurement of dispersion is an up-gradation of the measurement of central tendency. When you have two data sets then the mean can be the same for the two datasets. But both datasets are different. (Different Category). That’s why the measurement of dispersion comes to exist. There are three types of Measurement of Dispersion

  1. Range
  2. Interquartile Range
  3. Standard Deviation

In this method of measurement, you will know how the data is spread out through range variance and Standard Deviation. Let’s know each of them in detail.

Range

It is the difference between the largest and smallest values in the dataset. You can easily calculate. It is affected by outliers and also not consider all the data values in the dataset. It is mostly used to find the minimum and maximum values in the dataset. For example, consider the following values in a set.

{ 10,3,50,45,30,100,75 } 

Here minimum value is 3 and the maximum value is 100. Therefore range will be the difference between the maximum and minimum value. So here range is 100-3 that is 97.

Standard Deviation

Standard Deviation or SD is a commonly used measure of dispersion. It tells how the data values are spread out about the mean of the dataset. Before calculation standard deviation you have to first find the mean, variance of the values. The formulae for the SD is the square root of the sum of squared deviations from the mean divided by the number of observations.

How to calculate the SD?

Step 1: Find the sample mean.

Sample Mean formula
Sample Mean Formula

Step 2: Calculate  Sample Standard Deviation using the result form the Step1.

Standard Deviation Formula
Standard Deviation Formula

The above formulae are for the Sample Standard Deviation. If you want to calculate Population SD then You will use N ( Number of Elements ) in the denominator.

How to calculate Standard Deviation (SD ) in Excel?

In Excel, you can use The following formulae for finding the Standard Deviation using the following syntax.

= STDEV(number1, [number2] ,....)

The number2 is optional. For example when I have put the = STDEV(B2:B) then I get the result 27.81. It means our data values are spread from the mean by 27.81.

SD in excel
Standard Deviation

 

Where you can use Standard Deviation in Real Life?

  1. Stock Market -To measure the Risk of the market. More risk more Standard Deviation
  2. Financial Prediction
  3. Weather Forecasting
  4. Manufacturing Plants – For testing and quality control.
  5. Real Estate – Buying risk of the household.

Interquartile Range

Interquartile Range is the measurement of variability in the dataset. Here you divide the dataset into four parts using quartiles. The value that divides the set into halves is known as quartiles. Q1, Q2, and Q3.

Initially, Q2 will divide the datasets into two half datasets. Now you have two sub-datasets upper sub-dataset and the lower sub-dataset.

Q1 is the median for the upper half of the sub-dataset and Q3 is the median for the lower half of the sub-dataset.

The interquartile range is equal to Q3 -Q1. In this measurement of dispersion, for considering the outlier you have to determine the fence for it. The formulae for the fence is 1.5 times the IQ (Interquartile Range). In addition, If you will take any number outside the fence then it will be an outlier. The fence determines the value that can be maximum and all the values outside it will be an outlier.

IQR = Q3-Q1

Fence = 1.5 IQR

Identifying Outliers in machine learning is an important task. You can find outliers in your data using the IQR techniques. Why we remove outliers? Its because it affects the training process of the dataset that leads to weak model building and less accuracy to predict the inputs. You have to carefully handle the outliers to remove this problem.

 

How to calculate Interquartile Range (IQR) in Excel?

In excel you can use the following functions for finding the Quartile.

=QUARTILE(data, quartile number)
=QUARTILE(data,1), for Q1
=QUARTILE(data,2), for Q2
=QUARTILE(data,3), for Q3

After finding all the quartiles you can use the mathematical calculation for finding the fence and IQR.

IQR
IQR and FENCE

You can see the Q2 is the median of the whole data. The value of the IQR is 23 and Fence is 34.5. When you add the Fence value with Q3 then you will get the value 57.5. All the values outside 57.5 will be Outliers.

You can also draw Box plot like the above data.

Box Plot
Box Plot

Conclusion

Measurement of dispersion tells how each value of the datasets is spread. In fact, the advantage of using the measurement of dispersion is that it considers all the values of the dataset. Now you must have understood the Measurement of Dispersion and how to calculate and use it in real life. If you have any questions then contact us. In the meantime, you can subscribe and like our Data Science Learner Page.

 

Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for signup. A Confirmation Email has been sent to your Email Address.

Something went wrong.





Source link

Face Detection and Recognition Using OpenCV: Python Hog Tutorial


Face Detection is currently a trending technology. You look out the offline world and internet world everywhere you see faces. Faces in pictures as well as in Videos. Of course, Our brain easily identifies the person in the pictures and videos. But we want that computer or mobiles itself identifies these things. Therefore In this intuition, I want you to build a simple but effective face detection using Computer Vision Algorithms.

But before you go further in the coding part, first of all, you should know how the Face Detections works inside the box.

How does the Face Detection work?

Face Detection is the ability to locate the faces in a photograph. You create a two steps pipeline for face detection.

Step 1: Build a Face Detection Model

You create a machine learning model that detects faces in a photograph and tell that it has a face or not.

Step 2: Use the Sliding Window Classifier.

After building the model in the step 1, Sliding Window Classifier will slides in the photograph until it finds the face. If it finds then, locations of the face are noted.

There are various face detection algorithms like HOG( Histogram of Oriented Gradients), Convolutional Neural Network. Both detect the face. The only difference is their accuracy. Deep Learning ( Convolutional Neural Network) method is more accurate than the HOG. But it requires more computational power like High GPU, CPU e.t.c as compared to HOG. That’ why HOG is widely used on Mobile Platforms.
I am not going in deep to tell you how the HOG method detects the image. Here you will know how to apply it. If you want to learn in details then you can take this course.

How does the Histogram of Oriented Gradients (HOG) works?

Let’s know How the HOG algorithm works step by step.

Step 1: Converts the input image to black and white.

HOG only considers the changes between the light and dark areas in the image. It ignores the color information. That’s why it converts colored image into the black and white image.

Step 2: Looks for the gradient

Now after the step 1, it looks for the gradient in each pixel. A gradient is a direction from the lighter area to the darker area. It repeats the process for the entire pixels of a black and white image and draws the gradient image of it.

How to train the model to detect the face?

The trained datasets are available like dlib, face recognition that is free to use. These libraries contain all the HOG represented images and built a machine learning model. If you want to build your own face dataset then go for the following steps.

Step 1: Collect the Training dataset.

The first stage is to collect the HOG represented images. You can create them or use the existing dataset openly available online.

Step 2: Train the model

You will build a classifier model to classify there is a face or not in the image. You will use all the HOG represented images for training the model.

Step 3: Detect the Face

Sliding Window Classifier works on it. It slides on the entire image until it returns true and detects the position of the image.

Lets code a simple and effective face detection in python. It takes a picture as an input and draws a rectangle around the faces.

Coding Face Detection

Step 1: Import the necessary library

import PIL.Image
import PIL.ImageDraw
import face_recognition

PIL is an open source Python image libraries that allow you to open, manipulate and save the different image file formats. It used to easily display the image and draw a line on the top of the image.
Face recognition library will give you access to use the face detection model. Thus it relieves you from building your own face detection model for finding the faces in the photograph.

Step 2: Load the Image into the Numpy array

In this step for manipulating the image, you have to first convert into the Numpy array. As you have to get the locations of the image.

image =face_recognition.load_image_file("images/sample_image.jpg")

The following is the input image we have to detect the faces.

Sample Image
Sample Image

Step 3: Find all the faces in the photograph

face_locations = face_recognition.face_locations(image)
no_of_faces = len(face_locations)
print(no_of_faces)

Output: 4

Step 4: Draw the rectangular shape.

You have to draw the rectangular shape around the faces. First, you will convert the image to the PIL Image using the fromarray() method. Then You will use the PIL Draw() method of for this.

pil_image = PIL.Image.fromarray(image)
for face_location in face_locations:
    top,right,bottom,left =face_location
    draw_shape = PIL.ImageDraw.Draw(pil_image)
    draw_shape.rectangle([left, top, right, bottom],outline="red")

Step 5: Save and Show the Image

You will use the save() and show() method for showing the final image. You can see it contains all the faces with the rectangular image.

#display and save the image
pil_image.save("images/output_image.jpg")
pil_image.show()

Output Image

Face Detection Output Image
Face Detection Output Image

Hurray, you have build your own face detection and Recognition mode. Now you can use all these codes in your projects like in face detection in camera e.t.c.  The full code is available on the GitHub. If you have any query about this then please contact us or message us Data Science Learner Page.

Other Queries

Q: What is hog descriptor in opencv python?

It is a feature descriptor that tells how many times the gradient orientation has been done on portions of the image. HOG focuses on the image shape and structure. The best thing is that it automatically detects edges in the images by extracting the gradient and orientation of the image. Thus it makes simple lines of code to detect the face on the image.

Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for signup. A Confirmation Email has been sent to your Email Address.

Something went wrong.





Source link

How to Draw JSON Bar Chart using d3.js ? 5 Steps


Data Visualization is a must for the Data Scientist. It makes them easy for doing an analysis of the data. If you search for the best framework for data visualization, then obviously you find most of the libraries that are not free. But D3.js is open source Javascript library for doing data visualization. In this article, you will know how to draw json bar chart using d3.js. Just follow the steps below to draw a beautiful bar chart.

What is JSON?

JSON stands for JavaScript Object Notation. It is text-based data used to represent structured data. It is mostly used to sending data in web and mobile applications.  For example, I want to authorize login to the user then I will use JSON format. Another example is like I want to show use something then also I will use JSON format data. It makes the development of applications easy and fast.

 

Step 1: Integrate the D3.js file.

First of all, for drawing a bar chart in d3.js you required to add js to the HTML page. You can directly integrate through CDN URL. Alternatively, you can download the latest version from their official URL. For this tutorial, I am using version 3.

<script src="https://d3js.org/d3.v3.min.js"></script>

Step 2:  Create variables for the chart

After integrating the d3.js on your web page. The next step is to define the basic variable for the width, height, x and y range of the variable. Add the following code to your webpage inside the <script></script> tag.

var margin  = {top: 20, right: 20, bottom: 100, left: 60},
        width   = 600 - margin.left - margin.right,
        height  = 400 - margin.top - margin.bottom,
        x       = d3.scale.ordinal().rangeRoundBands([0,width], 0.5),
        y       = d3.scale.linear().range([height,0]);

In the above code, I defined the variable margin, width, height,x, and y ranges (Scaling). This is done to make sure that our bar chart looks good.

Step 3: Draw the axis for the chart.

In this step, you will define the axis for the SVG. Doing this it will fit the data in the JSON automatically and also name the x and y-axis. Use the following code to draw an axis on the chart.

  var xAxis   = d3.svg.axis()
        .scale(x)
        .orient("bottom");
  var yAxis   = d3.svg.axis()
        .scale(y)
        .orient("left")
        .ticks(5)
        .innerTickSize(-width)
        .outerTickSize(0)
        .tickPadding(10);

I defined two axis variables xAxis and yAxis and use the scale(x) and scale(y ) defined in step 2. The main thing the above code will do it will draw the levels on the x and y-axis

Step 4:  Create an SVG File.

After step3, now I will create an SVG and define its attributes. Use the following code to draw an SVG.

var svg     = d3.select("#wordCountContainer")
        .append("svg")
        .attr("width", width + margin.left + margin.right)
        .attr("height", height + margin.top + margin.bottom)
        .append("g")
        .attr("transform", "translate(" + margin.left + "," + margin.top + ")");

Let’s know about the above code. All the output after the assignment operator ( = ) will be assigned to the variable SVG. After selecting the id wordCountContainer an SVG will append inside it with the width, height. Next, the append(g) will do grouping and shifting the SVG from left and top with the defined pixel.

Step 5: Reading and mapping of JSON data

Now the next step before final execution is to read data from JSON and map the x and y domain from the data. You will read the JSON using d3.json() method. Continue the above code with the following code.

d3.json("data/contentWordCount.json", function (data)
    {
        x.domain(data.map(function (d)
        {
            return d.name;
        }));

        y.domain([0, d3.max(data, function (d)
        {
            return d.wc;
        })]);

        svg.append("g")
            .attr("class", "x axis")
            .attr("transform", "translate(0, " + height + ")")
            .call(xAxis)
            .selectAll("text")
            .style("text-anchor", "middle")
            .attr("dx", "-0.5em")
            .attr("dy", "-.55em")
            .attr("y", 30)
            .attr("transform", "rotate(0)" );

        svg.append("g")
            .attr("class", "y axis")
            .call(yAxis)
            .append("text")
            .attr("transform", "rotate(-90)")
            .attr("y", 5)
            .attr("dy", "0.8em")
            .attr("text-anchor", "end")
            .text("Word Count");

        svg.selectAll("bar")
            .data(data)
            .enter()
            .append("rect")
            .style("fill", "orange")
            .attr("x", function(d)
            {
                return x(d.name);
            })
            .attr("width", x.rangeBand())
            .attr("y", function (d)
            {
                return y(d.wc);
            })
            .attr("height", function (d)
            {
                return height - y(d.wc);
            })

The methods x.domain() and y.domain() methods map the data for the x and y-axis. There is two grouping done first on the x-axis and other on the y-axis.  After that bars from the data drawn using the method SVG.selectAll(“bar). The data(data) will choose the JSON data and append rectangles according to it.  There are four attributed defined inside the svg.selectAll(“bar”) and the map is done along with JSON data. If you want to know more about the above attributes and methods read the below article.

How to create a Simple D3.js Bar Chart? 

The following is the Full Code.

style.css

            svg {
			border: 1px solid #000;
		}
		body, html {
	    width: 100%;
	    height: 100%;
	    margin: 0 auto;
		}

		.graph {
		    width: auto;
		}

		.tooltip {
		    text-decoration: underline;
		}

		.axis {
		    font: 10px Georgia, Arial, sans-serif;
		}

		.axis path, .axis line {
		    fill: none;
		    stroke: #dadada;
		    shape-rendering: crispEdges;
		}

Inside the body tag.

<div class = "graph" id="wordCountContainer"></div>
var margin  = {top: 20, right: 20, bottom: 100, left: 60},
        width   = 600 - margin.left - margin.right,
        height  = 400 - margin.top - margin.bottom,
        x       = d3.scale.ordinal().rangeRoundBands([0,width], 0.5),
        y       = d3.scale.linear().range([height,0]);

//draw axis
    var xAxis   = d3.svg.axis()
        .scale(x)
        .orient("bottom");
	var yAxis   = d3.svg.axis()
        .scale(y)
        .orient("left")
        .ticks(5)
        .innerTickSize(-width)
        .outerTickSize(0)
        .tickPadding(10);

 var svg     = d3.select("#wordCountContainer")
        .append("svg")
        .attr("width", width + margin.left + margin.right)
        .attr("height", height + margin.top + margin.bottom)
        .append("g")
        .attr("transform", "translate(" + margin.left + "," + margin.top + ")");

d3.json("contentWordCount.json", function (data)
    {
        x.domain(data.map(function (d)
        {
            return d.name;
        }));

        y.domain([0, d3.max(data, function (d)
        {
            return d.wc;
        })]);

        svg.append("g")
            .attr("class", "x axis")
            .attr("transform", "translate(0, " + height + ")")
            .call(xAxis)
            .selectAll("text")
            .style("text-anchor", "middle")
            .attr("dx", "-0.5em")
            .attr("dy", "-.55em")
            .attr("y", 30)
            .attr("transform", "rotate(0)" );

        svg.append("g")
            .attr("class", "y axis")
            .call(yAxis)
            .append("text")
            .attr("transform", "rotate(-90)")
            .attr("y", 5)
            .attr("dy", "0.8em")
            .attr("text-anchor", "end")
            .text("Word Count");

        svg.selectAll("bar")
            .data(data)
            .enter()
            .append("rect")
            .style("fill", "orange")
            .attr("x", function(d)
            {
                return x(d.name);
            })
            .attr("width", x.rangeBand())
            .attr("y", function (d)
            {
                return y(d.wc);
            })
            .attr("height", function (d)
            {
                return height - y(d.wc);
            });
		
})

The file contentWordCount.json has the following values.


[
{"name": "Original Word Count", "wc": 100},
{"name": "Model Word Count", "wc": 90 }
]

 

When you run the index.html file. You will see the following output.

json bar chart using d3
Output

I hope you learned how to create JSON Bar Chart using d3.js. If you have any queries on d3.js please contact us. We are always ready to help you. You can also like our official Data Science Learner Page.

Source

D3.js Offical Website

Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for signup. A Confirmation Email has been sent to your Email Address.

Something went wrong.





Source link

How to Create a Bar Chart From a DataFrame in Python ? (Plotly + Flask)


Analyzing the Data through visualization is the best way to understand them. It feels bored when you just look at the inferred numbers and not gain much information. It requires much time to spend for filtering out the outcomes and reasons. Therefore rather than extracting analysis from the numbers you should visualize the data using the different figures. In this post, you will learn how to create a bar chart from data frame using Plotly and how to integrate it with you Flask Web APP.

Step by Step for creating a Bar Chart?

Step 1: Import the necessary libraries

The first step is to import the necessary libraries. I am using Plotly for plotting the chart and Flask for integrating flask with Plotly. Pandas for reading the CSV and manipulation of the excel.

from flask import Flask,render_template
import pandas as pd
import numpy as np
from charts.bar_chart import plot_chart
import plotly.graph_objs as go
import plotly.offline as plt

Step 2: Load the Dataset.

You will plot the chart for a real-life example. Therefore I have a dataset for the countries population, GDP e.t.c. You can download it from here.

Kaggle Countries of the World Dataset

df = pd.read_csv("countries.csv")

Step 3: Configure the Layout and the Data for the Plot.

Plotly requires the data and layout for plotting. First, you will create a trace for the bar chart and then pass the x-axis and y-axis values you want to plot. In this case, I want the x-axis as country name and the y-axis as GDP data. Use the following code

trace = go.Bar(x=df["Country"][0:20], y=df["GDP ($ per capita)"])
layout = go.Layout(title="GDP of the Country", xaxis=dict(title="Country"),
yaxis=dict(title="GDP Per Capita"), )
data = [trace1]
fig = go.Figure(data=data, layout=layout)
plt.plot(fig)

Step 4: Integrate it with the Flask App.

The above method is only for plotting the Chart offline. If you want to integrate this chart with the Flask App. then you have to dump the figure into JSON Object. As figures generated by the Ploty framework are in dictionary and list format. Here I am passing the JSON to the flask app with the variable name plot. Let’s create the Flask Route and add the above code inside it. Use the following code

@app.route("/bar_chart")
def bar_chart_plot():
    df = pd.read_csv("countries.csv")
    trace1 = go.Bar(x=df["Country"][0:20], y=df["GDP ($ per capita)"])
    layout = go.Layout(title="GDP of the Country", xaxis=dict(title="Country"),
                       yaxis=dict(title="GDP Per Capita"), )
    data = [trace1]
    fig = go.Figure(data=data, layout=layout)
    fig_json = json.dumps(fig, cls=plotly.utils.PlotlyJSONEncoder)
    return render_template('charts.html', plot=fig_json)

In the last line of the function, you will pass the HTML file name and plot variable for using it in an HTML file. Below is the code that will contain inside the HTML File. Create a “charts.html” file and put the following things. Plotly requires d3 js and plotly.js for showing charts to the HTML. Therefore I have added both scripts inside the head section. In the body part, I am calling the Ploty.plot() javascript method for creating the bar chart for the data and layout we get as the JSON format.

<head>

<script src=”https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js”></script>

<script src=”https://cdn.plot.ly/plotly-latest.min.js”></script>

</head>

<body>

<div class=”chart” id=”barchart”>

<script>

        var fig = {{plot | safe}};

        Plotly.plot(‘barchart’,fig.data,fig.layout,{displaylogo: false});

    </script>

</div>

</body>

When you run the Flask App you will get the output like this.

Create a bart chart : Plotly

 

Other Methods

There is also another method to create a bar chart from dataframe in python. You can use directly pandas python packages for that. To do this you will use the pandas.DataFrame.plot.bar() function. It accepts the x and y-axis values you want to draw the bar. Below is the demo code for creating a simple bar chart from dataframe using the pandas module.

import pandas as pd
df = pd.DataFrame({'x':['A', 'B', 'C'], 'y':[100, 200, 300]})
ax = df.plot.bar(x='x', y='y')

Output

Creating dataframe bar chart using pandas
Creating dataframe bar chart using pandas

Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for signup. A Confirmation Email has been sent to your Email Address.

Something went wrong.





Source link

AI Software Engineer vs Data Scientist : Role and Responsibility


Most of us are confused about these job Tittle – AI Software Engineer and Data Scientist. Both of the job titles are high paying in the industries. I have heard the same question in multiple communities. Consequently, I decided to write an article on this topic. Get the complete detail about the difference between Machine Learning Engineer or  AI Engineer Software vs Data Scientist: Role and Responsibility. In order to develop larger intelligent software products, both roles are equally important. let’s explore –

AI Software Engineer (Machine Learning Engineer)  Role and Responsibility  –

An AI Engineer’s responsibility starts from creating a usable product for clients and customers where AI is involved. In order to simplify the role and responsibility of AI engineers, we can break it two parts – core and optional responsibilities.

AI  Software Engineer core Role and Responsibility –

An AI engineer works closely with Data Scientist and performs the below task –

  1. Build Code Infrastructure – Basically, when data scientists work they usually build models on IDEs. When we need to integrate that with Products we have to solve so many problems. Now it is an AI engineer’s responsibility to create an easy deployable version of ML -Models using Docker like technologies. Basically packaging of ML model and its Integration into Products.
  2. Creating End Point API – Most of the data science model needs to be deployed as a web service. Now we can call these web service API from and end front end like – Mobile app or Web etc. So AI developer needs to create secure endpoint  API for ML models if required.

AI Software Engineer optional  Role and Responsibility –

These responsibilities are optional for AI Engineer –

  1. Build Machine Learning Model – Actually this is a core responsibility for data scientists. But In some organization, AI software Engineer has to provide end to end AI solution.
  2. Data Collection and building pipeline – For large projects where data volume is higher, Some time AI engineer has to perform data engineer’s job as well.

Who is full-stack AI engineer –

Someone who has all skills as mention above. I mean who can work as a developer ( AI software Engineer) and data scientist in an organization is a full-stack AI engineer. They work as a one-man army in entire projects. Generally, I have seen small organizations hire full-stack AI developers. On the opposite side, Big companies have a big army of developers. In MNC’s there will be specific persons for specific tasks. But the changing trend in the business and IT sector, Full stack developer, and AI engineer are in huge demand. It will be a trend with the growth of a startup is this era.

Data Scientist’s Role and Responsibilities –

In this section, nothing is new. All the optional responsibility for AI developers are most likely data science core responsibility. In fact, a data scientist has to perform following task –

1.Data science problem formulation

2. collect the relevant data

3. clean the data

4. Apply preprocessing steps like feature engineering over it.

5. split data set into training and testing set

6. Train the model

7.tune the model .etc

Usually, Data engineers have a very different task to data scientists but in some scenarios, a data scientist needs to fulfill both. In a similar way as AI software Engineer has to work end to end.

I think now there is a clear boundary between both Job role.

Are Big Data Technologies like ( Hadoop and Map Reduce etc  ) must have?

No, neither it is must-have for data scientist nor for AI engineer as well. It is just good to have knowledge of both job roles. Actually It is only just to have for data engineers. But if you know any of the Big data technology as a Data Scientist you will be in the high demand.

Conclusion –

Truly speaking these are just boundaries. In real-time you will see engineers are cross-functional. People are transforming their profiles. I have also written a similar article –  How a Java Engineer can Transform his career into Data Science | Java for Data Science? Still, we have tried to give an Imaginary view of these two job profiles in the AI industry. Well! Any article is not complete it gets a response from the reader. The positive response becomes our motivation and negative become the suggestions. In short please comment below if you have any queries or suggestions for the topic – AI Software Engineer vs Data Scientist: Role and Responsibility. 

Data Science Learner Team 

 

Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for signup. A Confirmation Email has been sent to your Email Address.

Something went wrong.





Source link