Showing posts with label Classification. Show all posts
Showing posts with label Classification. Show all posts

Tuesday, October 2, 2018

Regression vs Classification in Machine Learning

REGRESSION :
  • The output variable takes continues values
  • This predicts a value from a continue set
  • Regression involves estimating or predicting a response
  • e.g. The price of a house depending on the 'size', 'location' can be some 'numerical value'. This numerical value can be continues. 
  • Given  f : x -> y,  if y is real number/continues, then this is a regression problem.
  • Regression models makes predictions that answer questions like the following:
    • what is the value of a house in Taipei, Taiwan ?
    • what is the probability that a user click on this ad ?
  • Different types of regression :
    • Linear regression
    • Logistic regression
    • Polynomial regression
    • Stepwise regression
    • Ridge regression
    • Lasso regression
    • ElasticNet regression
    • and many more ....

CLASSIFICATION :
  • The output variable takes class labels
  • classification predicts the "belonging" to the class
  • classification is identifying group membership
  • e.g. The prediction of house price can be classified into 'very costly', 'costly', 'affordable', 'cheap', 'very cheap'. Here each class may correspond to some range of values.
  • Given  f : x -> y,  if y is discrete/categorical variable, then this is classification problem.
  • Classification model predict discrete values that ans. the questions like the following:
    • Is the given email message spam or not spam ?
    • Is this an image of dog, a cat or a hamster ?
  • Different classification methods:
    • Linear classifier: Logistic regression, Naive Bayes classifier
    • Support Vector Machines
    • Decision Trees
    • Boosted Trees
    • Random forest
    • Neural Networks
    • Nearest neighbor
    • and many more ....



[src] :

Tuesday, August 14, 2018

Difference between Classification and Clustering in Machine Learning



Classification
Clustering
What is it?
Given a set of historical/old data along with their class name and a set of new data, classification is the process of assigning each new data with class name that is obtained from the old/historical data. 
Given a set of samples/data, clustering is the process of grouping the data based on their similarities and the patterns of the data.
Type of input data
Set of data with label/class name
Only the data set. No labeling is required.
Input
  • A set of samples or data
  • A set of classes
A set of samples
Output
Class name of each new sample based on the classes of existing samples
Groupism of set of samples based on the data patterns. 
Each sample will be assigned with a group/label/class name.
Number of classes can be known.
Number of classes
Number of classes are known
Unknown number of classes. 
(number of classes can be known after clustering process is over)
Learning type
Supervised learning
Unsupervised learning
Algorithms
Decision tress
Bayesian classifier
SVM
K-mean
Expectation maximization
Dependencies
Depend on training data
no training data is required. No prior knowledge is required.





[src] : 

Friday, May 25, 2018

Classification using NaiveBayse Algorithm using Python

#Import Library of Gaussian Naive Bayes model
from sklearn.naive_bayes import GaussianNB
import numpy as np
import pandas as pd
 
#assigning predictor and target variables
dataF = pd.DataFrame()
dataF["x1"] = np.random.random_sample((5,)) + 1
dataF["x2"] = np.random.random_sample((5,)) + 2 

dataL = pd.DataFrame()
dataL = np.array([3, 3, 4, 3, 4])
 
#Create a Gaussian Classifier
model = GaussianNB()

# Train the model using the training sets 
model.fit(dataF, dataL)

#Predict Output 
predicted= model.predict([[1,2],[3,4]])
print(predicted)

Output: ([3,4])
 
-Thank you