How to make an Averaged Perceptron using Shogun?

This recipe helps you to make an Averaged Perceptron using Shogun.

Recipe Objective

This recipe explains how to make an Averaged Perceptron using Shogun.
For more related projects-
Project 1
Project 2

Learn to Implement Customer Churn Prediction Using Machine Learning in Python

Averaged Perceptron

The averaged Perceptron uses the averaged weight and bias. It is an online binary classifier which is an extension of the standard Perceptron algorithm. Given a vector, a predicted class is given by:
f(weight. a + bias)
Here, weight is the average weight vector, bias is the average bias and f() is a step function where step function is equal to 1 for 'a' greater than 0, equal to -1 for 'a' less than 0, and equal to zero for 'a' equal to zero.

x_train = RealFeatures(feats_train)
x_test = RealFeatures(feats_test)
y_train = BinaryLabels(labels_train)
y_test = BinaryLabels(labels_test)

lr = 1.0
maxx = 1000
perceptron = AveragedPerceptron(x_train, y_train)
perceptron.set_learn_rate(y_rate)
perceptron.set_max_iter(maxx)

perceptron.train()
perceptron.set_features(x_test)
predict = perceptron.apply()

eval = AccuracyMeasure()
accuracy = eval.evaluate(predict, y_test)

What Users are saying..

profile image

Ray han

Tech Leader | Stanford / Yale University
linkedin profile url

I think that they are fantastic. I attended Yale and Stanford and have worked at Honeywell,Oracle, and Arthur Andersen(Accenture) in the US. I have taken Big Data and Hadoop,NoSQL, Spark, Hadoop... Read More

Relevant Projects

Build Customer Propensity to Purchase Model in Python
In this machine learning project, you will learn to build a machine learning model to estimate customer propensity to purchase.

Build CI/CD Pipeline for Machine Learning Projects using Jenkins
In this project, you will learn how to create a CI/CD pipeline for a search engine application using Jenkins.

Learn to Build a Neural network from Scratch using NumPy
In this deep learning project, you will learn to build a neural network from scratch using NumPy

Build CNN for Image Colorization using Deep Transfer Learning
Image Processing Project -Train a model for colorization to make grayscale images colorful using convolutional autoencoders.

End-to-End ML Model Monitoring using Airflow and Docker
In this MLOps Project, you will learn to build an end to end pipeline to monitor any changes in the predictive power of model or degradation of data.

Learn to Build a Polynomial Regression Model from Scratch
In this Machine Learning Regression project, you will learn to build a polynomial regression model to predict points scored by the sports team.

Build Regression (Linear,Ridge,Lasso) Models in NumPy Python
In this machine learning regression project, you will learn to build NumPy Regression Models (Linear Regression, Ridge Regression, Lasso Regression) from Scratch.

Build a Wealth Management Agentic AI Chatbot with MS Fabric
In this Agentic AI project , you will learn to build an intelligent financial assistant that autonomously analyzes your financial data, assesses risks, and designs personalized investment strategies, making wealth management more efficient and personalized to your needs

Build an AI Insurance Agent for Eligibility Analysis Using CrewAI
Build an AI Insurance Agent that automates eligibility checks by extracting medical details, mapping conditions to policy terms, and generating explainable coverage decisions using CrewAI and LLMs. This is an upcoming project that is expected to be launched in June.

AI Video Summarization Project using Mixtral, Whisper, and AWS
In this AI Video Summarization Project, you will build a quiz generation tool by extracting key concepts from educational videos and generating concise summaries.

OSZAR »