DeepMind’s RoboCat learns to perform a range of robotics tasks

DeepMind’s RoboCat learns to perform a range of robotics tasks Kyle Wiggers 7 hours

DeepMind says that it’s developed an AI model, called RoboCat, that can perform a range of tasks across different models of robotic arms. That alone isn’t especially novel. But DeepMind claims that the model is the first to be able to solve and adapt to multiple tasks and do so using different, real-world robots.

“We demonstrate that a single large model can solve a diverse set of tasks on multiple real robotic embodiments and can quickly adapt to new tasks and embodiments,” Alex Lee, a research scientist at DeepMind and a co-contributor on the team behind RoboCat, told TechCrunch in an email interview.

RoboCat — which was inspired by Gato, a DeepMind AI model that can analyze and act on text, images and events — was trained on images and actions data collected from robotics both in simulation and real life. The data, Lee says, came from a combination of other robot-controlling models inside of virtual environments, humans controlling robots and previous iterations of RoboCat itself.

To train RoboCat, researchers at DeepMind first collected between 100 to 1,000 demonstrations of a task or robot using a robotic arm controlled by a human. (Think having a robot arm pick up gears or stack blocks.) Then, they fine-tuned RoboCat on the task, creating a specialized “spin-off” model that practiced on the task an average of 10,000 times.

Leveraging both the data generated by the spin-off models and the demonstration data, the researchers continuously grew RoboCat’s training data set — and trained subsequent new versions of RoboCat.

DeepMind RoboCat

Image Credits: DeepMind

The final version of the RoboCat model was trained on a total of 253 tasks and benchmarked on a set of 141 variations of these tasks, both in simulation and in the real world. DeepMind claims that, after observing 1,000 human-controlled demonstrations collected over several hours, RoboCat learned to operate different robotic arms.

While RoboCat had been trained on four kinds of robots with two-pronged arms, the model was able to adapt to a more complex arm with a three-fingered gripper and twice as many controllable inputs.

Lest RoboCat be heralded as the end-all be-all of robot-controlling AI models, its success rate across tasks varied drastically in DeepMind’s testing — from 13% on the low end to 99% on the high end. That’s with 1,000 demonstrations in the training data; the successes were predictably less common with half as many demonstrations.

Still, in some scenarios, DeepMind claims that RoboCat was able to learn new tasks with as few as 100 demonstrations.

Taken further, Lee believes that RoboCat could herald a lowering of the barrier to solve new tasks in robotics.

“Provided with a limited number of demonstrations for a new task, RoboCat can be fine-tuned to the new tasks and in turn self-generate more data to improve even further,” he added.

Going forward, the research team aims to reduce the number of demonstrations needed to teach RoboCat to complete a new task to fewer than 10.

Microsoft Releases 1.3 Bn Parameter Language Model, Outperforms LLaMa

Microsoft Releases Textbook Quality Model with 1.3 Billion Parameters

Large language models are getting smaller with great examples like LLaMa and Falcon. Now, Microsoft Research has upped the game with an even smaller model. phi-1 is a transformer based model with just 1.3 billion parameters.

The research paper titled, Textbooks Are All You Need, describes that the model was trained for just four days on 8 A100s with ‘textbook quality’ dataset from the internet with 6 billion tokens, along with synthetically generated textbooks from GPT-3.5 with 1 billion tokens.

Click here to read the paper. The model will be available on Hugging Face soon.

Despite being small in size, phi-1 attained 50.6% on HumanEval and 55.5% on MBPP. There is another even smaller model with just 350 million parameters called phi-1-small that is trained with the same pipeline as the larger one which still achieves 45% on HumanEval.

For comparison, any other model that achieves greater than 50% on HumanEval is 100 times bigger than this with a large dataset size.

Ronen Eldan, one of the co-authors of the paper said that using the textbook quality training data for coding, the results were better than they had anticipated.

In a discussion on HackerNews, a user explains that this would not have been possible without using high quality synthetic dataset that was produced by GPT-3.5. It is clear that training on data from GPT models improves the accuracy and efficiency of the models.

Instead of increasing the size of the model, by improving the quality of the data models are performing way better. This might result in a shift of paradigm in LLM research with focusing more on the architecture and training of models.

Similarly, an open source alternative to GPT-4, Orca, with just 13 billion parameters was also trained on data by GPT-4 and was able to outperform OpenAI’s offering on several benchmarks.

On the other hand, a recent paper – The Curse of Recursion – says that training on other LLMs data actually reduces the quality of output of the new model as it results in data poisoning. This is also called the false promise of imitating proprietary LLMs, as the model also inherits flaws from GPT based models.

The post Microsoft Releases 1.3 Bn Parameter Language Model, Outperforms LLaMa appeared first on Analytics India Magazine.

Closing the Gap Between Human Understanding and Machine Learning: Explainable AI as a Solution

Closing the Gap Between Human Understanding and Machine Learning: Explainable AI as a Solution
Image by Bing Image Creator Introduction

Have you ever opened your favorite shopping app and the first thing you see is a recommendation for a product that you didn’t even know you needed, but you end up buying thanks to the timely recommendation? Or have you opened your go-to music app and been delighted to see a forgotten gem by your favorite artist recommended right on the top as something “you might like”? Knowingly, or unknowingly, all of us encounter decisions, actions, or experiences that have been generated by Artificial Intelligence (AI) today. While some of these experiences are fairly innocuous (spot-on music recommendations, anyone?), some others might sometimes cause some unease (“How did this app know that I have been thinking of doing a weight loss program?”). This unease escalates to worry and distrust when it comes to matters of privacy about oneself and one’s loved ones. However, knowing how or why something was recommended to you can help with some of that unease.

This is where Explainable AI, or XAI, comes in. As AI-enabled systems become more and more ubiquitous, the need to understand how these systems make decisions is growing. In this article, we will explore XAI, discuss the challenges in interpretable AI models, advancements in making these models more interpretable and provide guidelines for companies and individuals to implement XAI in their products to foster user trust in AI.

What is Explainable AI?

Explainable AI (XAI) is the ability of AI systems to be able to provide explanations for their decisions or actions. XAI bridges the important gap between an AI system deciding and the end user understanding why that decision was made. Before the advent of AI, systems would most often be rule-based (e.g., if a customer buys pants, recommend belts. Or if a person switches on their “Smart TV”, keep rotating the #1 recommendation between fixed 3 options). These experiences provided a sense of predictability. However, as AI became mainstream, connecting the dots backward from why something gets shown or why some decision is made by a product isn’t straightforward. Explainable AI can help in these instances.

Explainable AI (XAI) allows users to understand why an AI system decided something and what factors went into the decision. For example, when you open your music app, you might see a widget called “Because you like Taylor Swift” followed by recommendations that are pop music and similar to Taylor Swift’s songs. Or you might open a shopping app and see “Recommendations based on your recent shopping history” followed by baby product recommendations because you bought some baby toys and clothes in the recent few days.

XAI is particularly important in areas where high-stakes decisions are made by AI. For example, algorithmic trading and other financial recommendations, healthcare, autonomous vehicles, and more. Being able to provide an explanation for decisions can help users understand the rationale, identify any biases introduced in the model’s decision-making because of the data on which it is trained, correct errors in the decisions, and help build trust between humans and AI. Additionally, with increasing regulatory guidelines and legal requirements that are emerging, the importance of XAI is only set to grow.

Challenges in XAI

If XAI provides transparency to users, then why not make all AI models interpretable? There are several challenges that prevent this from happening.

Advanced AI models like deep neural networks have multiple hidden layers between the inputs and output. Each layer takes in the input from a previous layer, performs computation on it, and passes it on as the input to the next layer. The complex interactions between layers make it hard to trace the decision-making process in order to make it explainable. This is the reason why these models are often referred to as black boxes.

These models also process high-dimensional data like images, audio, text, and more. Being able to interpret the influence of each and every feature in order to be able to determine which feature contributed the most to a decision is challenging. Simplifying these models to make them more interpretable results in a decrease in their performance. For example, simpler and more “understandable” models like decision trees might sacrifice predictive performance. As a result, trading off performance and accuracy for the sake of predictability is also not acceptable.

Advancements in XAI

With the growing need for XAI to continue building human trust in AI, there have been strides in recent times in this area. For example, there are some models like decision trees, or linear models, that make interpretability fairly obvious. There are also symbolic or rule-based AI models that focus on the explicit representation of information and knowledge. These models often need humans to define rules and feed domain information to the models. With the active development happening in this field, there are also hybrid models that combine deep learning with interpretability, minimizing the sacrifice made on performance.

Guidelines to Implement XAI in Products

Empowering users to understand more and more why AI models decide what they decide can help foster trust and transparency about the models. It can lead to improved, and symbiotic, collaboration between humans and machines where the AI model helps humans in decision-making with transparency and humans help tune the AI model to remove biases, inaccuracies, and errors.

Below are some ways in which companies and individuals can implement XAI in their products:

  1. Select an Interpretable Model where you can – Where they suffice and serve well, interpretable AI models should be selected over those that are not interpretable easily. For example, in healthcare, simpler models like decision trees can help doctors understand why an AI model recommended a certain diagnosis, which can help foster trust between the doctor and the AI model. Feature engineering techniques like one-hot coding or feature scaling that improve interpretability should be used.
  2. Use Post-hoc Explanations – Use techniques like feature importance and attention mechanisms to generate post-hoc explanations. For example, LIME (Local Interpretable Model-agnostic Explanations) is a technique that explains the predictions of models. It generates feature importance scores to highlight every feature’s contribution to a model’s decision. For example, if you end up “liking” a particular playlist recommendation, the LIME method would try to add and remove certain songs from the playlist and predict the likelihood of your liking the playlist and conclude that the artists whose songs are in the playlist play a big role in your liking or disliking the playlist.
  3. Communication with Users – Techniques like LIME or SHAP (SHapley Additive exPlanations) can be used to provide a useful explanation about specific local decisions or predictions without necessarily having to explain all the complexities of the model overall. Visual cues like activation maps or attention maps can also be leveraged to highlight what inputs are most relevant to the output generated by a model. Recent technologies like Chat GPT can be used to simplify complex explanations in simple language that can be understood by users. Finally, giving users some control so they can interact with the model can help build trust. For example, users could try tweaking inputs in different ways to see how the output changes.
  4. Continuous Monitoring – Companies should implement mechanisms to monitor the performance of models and automatically detect and alarm when biases or drifts are detected. There should be regular updating and fine-tuning of models, as well as audits and evaluations to ensure that the models are compliant with regulatory laws and meeting ethical standards. Finally, even if sparingly, there should be humans in the loop to provide feedback and corrections as needed.

Conclusion

In summary, as AI continues to grow, it becomes imperative to build XAI in order to maintain user trust in AI. By adopting the guidelines articulated above, companies and individuals can build AI that is more transparent, understandable, and simple. The more companies adopt XAI, the better the communication between users and AI systems will be, and the more users will feel confident about letting AI make their lives better
Ashlesha Kadam leads a global product team at Amazon Music that builds music experiences on Alexa and Amazon Music apps (web, iOS, Android) for millions of customers across 45+ countries. She is also a passionate advocate for women in tech, serving as co-chair for the Human Computer Interaction (HCI) track for Grace Hopper Celebration (biggest tech conference for women in tech with 30K+ participants across 115 countries). In her free time, Ashlesha loves reading fiction, listening to biz-tech podcasts (current favorite — Acquired), hiking in the beautiful Pacific Northwest and spending time with her husband, son and 5yo Golden Retriever.

More On This Topic

  • An introduction to Explainable AI (XAI) and Explainable Boosting Machines…
  • The Explainable Boosting Machine
  • Computational Complexity of Deep Learning: Solution Approaches
  • The Gap Between Deep Learning and Human Cognitive Abilities
  • Free MIT Courses on Calculus: The Key to Understanding Deep Learning
  • Essential Features of An Efficient Data Integration Solution

How to use ChatGPT to build your resume

Person asking ChatGPT questions on a laptop

Whether you're searching for your first job out of college or have been in the labor market for decades, there's one thing we can all agree on — creating a resume that attracts the eye of recuiters is a tough challenge.

How to use ChatGPT to write: Code | Excel formulas | Essays | Cover letters

As if landing a job that aligns with your qualifications and expectations wasn't difficult enough, you also have to sum up all of your professional experiences and strengths into one application.

Also: How to use ChatGPT: Everything you need to know

That application consists of many moving parts, such as references, experiences, a cover letter, creative portfolio, and the most intimidating one for some — the CV or resume.

Well, now the generative AI tool ChatGPT is here to help make the resume-building process a breeze.

How ChatGPT can help with your job application

You can use ChatGPT to help you generate ideas and bullet points for your role from scratch, or to refine and optimize your current bullet points that might not be hitting the mark.

Also: How to make ChatGPT provide sources and citations

Beyond bullet points, the AI tool can help you answer questions about putting together your resume. Here is how to get started.

Side note: If you have access to Bing Chat, it could serve as a great assistant for this process because it has all the same capabilities as ChatGPT, but with access to the internet.

FAQs

How much does it cost for ChatGPT to write my resume?

ChatGPT is currently free to use regardless of what you use it for, which includes resume-building assistance.

How can ChatGPT help me with my resume?

ChatGPT can generate text for different parts of your resume, including your professional summary and individual bullet points for each experience.

Also: How to nail the 'Do you have any questions for me?' part of the interview

The chatbot can also help enhance your current resume by optimizing your text. If you have any questions about how to format your resume and what to include, ChatGPT is able to give you some answers.

What should I put in my resume?

Ideally, you want a resume to highlight all of the accomplishments of your career. This can include any educational, professional, and leadership experiences that are meaningful to you.

Also: How to protect yourself from ChatGPT-generated job scams

You should also include as much detail about your unique experiences to make you stand out from other applicants.

See also

Dropbox launches $50M AI-focused venture fund, intros AI features

Dropbox launches $50M AI-focused venture fund, intros AI features Kyle Wiggers 7 hours

Not content to sit on the sidelines of the generative AI race, Dropbox today launched Dropbox Ventures, a new $50 venture fund focused on startups in the AI space.

The company’s first venture arm, Dropbox Ventures will provide mentorship in addition to financial support to build AI-powered products that “shape the future of work,” Dropbox said in a press release.

VCs have steadily increased their positions in AI over the past few years, spurred recently by the growth in generative AI. According to GlobalData, AI startups received over $52 billion in funding across more than 3,300 deals in the last year alone.

Corporate initiatives are a major source of that funding. For example, Salesforce Ventures, Salesforce’s VC division, plans to pour $500 million into startups developing generative AI technologies. Workday recently added $250 million to its existing VC fund specifically to back AI and machine learning startups. And OpenAI, the company behind the viral chatbot ChatGPT, has raised a $175 million fund to invest in AI startups.

New AI-powered features

Putting its money where its mouth is, Dropbox today announced new AI-powered additions to its flagship cloud storage product.

The first, called Dropbox Dash, is a “universal” search bar can canvas across tools, content and apps from third-party platforms including Google Workspace, Microsoft Outlook, Salesforce and Notion. Designed to help find and organize various types of content, Dash will “learn, evolve and improve” the more customers use it, Dropbox says.

Dropbox AI

Dropbox Dash.

“Soon, Dash will be able to pull from your information and your company’s information to answer questions and surface relevant content using generative AI,” the company wrote in a blog post. “You won’t need to sift through all your company’s internal links and pages to find out when the next company holiday is — you’ll just be able to ask Dash and get an answer, fast.”

In addition to surfacing content, Dash can create collections — Stacks — for links, offering a way to save, organize and retrieve URLs. Stacks are accessible from the new Start Page, which also hosts shortcuts to recently-accessed work in Dropbox and the Dash search bar.

Dropbox AI

The new Start Page in Dropbox.

Dropbox’s other new AI innovation is Dropbox AI, which summarizes and extracts information from files stored in a Dropbox account.

Dropbox AI can review and generate summaries from documents as well as video previews. And it can answer questions in a chatbot-like fashion, drawing from the contents of research papers, contracts, meeting recordings and more.

At launch, Dropbox AI works with file previews. But it’ll soon expand to folders and entire Dropbox accounts.

Given AI’s tendency to go off the rails, one might wonder about the accuracy of Dropbox AI’s summaries. Are they consistent? Can they be trusted?

To allay concerns, Dropbox reaffirmed its commitment to building AI technologies “so that they’re as fair and reliable as possible.” Of course, the words of a corporation don’t carry the same weight as, say, an independent audit, but take them for what they’re worth.

“In this next era of AI, it’s more important than ever that we protect our customers’ privacy, act transparently, and limit bias in our AI technologies,” Dropbox wrote.

Dropbox Dash is currently available in English to select customers in beta. Dropbox AI for file previews is in Alpha, and available in the U.S. to all Dropbox Pro customers ahead of a rollout to select Dropbox Teams.

Who Needs Teachers When You have AI?

GPT engineer is the newest addition to make your life simple. Just like a dedicated teacher, you can ask it to help you build anything. The AI will ask for clarifications and you can finish any coding project within minutes — self-learning has never been easier.

With the easy availability of options such as applications that help build and assist with anything, free classes on building neural networks by industry experts, and free courses on Generative AI, people are slowly being spoiled for choice when it comes to self-learning. Armed with these options, a person can self-teach and upgrade their skills relevant to today’s world. How is this going to impact the real, traditional teachers — will they continue to be pertinent today?

AI Competes with Teachers

ChatGPT doing my homework 🔥 🔥 #AI #ChatGPT #OpenAI pic.twitter.com/XT1UhX7LH8

— Victor Beit ✪ (@im_beit) June 13, 2023

Self-learning and online study courses have always been around. Coursera, Udemy, Khan Academy and many other study platforms offer various courses and study material for everybody. However, with the rise of ChatGPT, all forms of learning courses, either keeping AI as the focus or using AI to assist with teaching, have risen.

The AI revolution has opened up avenues for people to upskill and learn on their own. Utilising applications that can help with coding, research, and data analysis, a myriad of functions that would have traditionally required some form of formal training is now almost eliminated.

The availability of a large number of ChatGPT plugins has opened the doors for executing a wide range of functions. With Code Interpreter plugin, multiple tasks including visualisation, analysis and data transformation can be done, pretty much equipping a person to become a data scientist of sorts. With the Wolfram plugin, all forms of powerful computation, access to real-time data, solving maths, learning science and other subjects can be easily done. A user can get access to any form of information and self-learn without a teacher.

Source: Wolfram

You even have an increasing number of AI agents designed to perform tasks autonomously and intelligently, which also raises the question of the efficacy of traditional teaching subjects. If we are building tools that are said to simplify a majority of operational tasks, then what will the value add of today’s teaching bring?

Improvise or Perish

Accepting that there is no escape from AI, the failing edtech giants are now customising their models by embracing AI-powered tools to stay afloat. Khan Academy launched Khanmigo, a GPT-4 powered virtual tutor and guide. Similarly, many other edtech platforms are now looking at incorporating LLM-powered applications to customise their teaching approach.

Recently, upGrad told AIM that they are planning to build their own LLM models to help learners. They already have GPT-powered chatbots to guide and improve their learner’s skill sets.

A number of edtech firms recently bore the brunt of expansion and improper planning owing to the pandemic. Amid massive layoffs across companies, edtechs too have had to let go of a number of employees. To add to the woe, the rapid expansion of ChatGPT pushed companies towards losses. Last month, US edtech firm Chegg experienced a loss close to $1 billion in market capitalisation.

Indian education company Doubtnut, which aids students with NEET and IIT JEE, has also faced workforce reduction. In spite of Indian edtech BYJU’s being on a firing spree with 1000 employees expected to be laid off soon, the company recently launched their AI suite of models for hyper-personalised learning. The company launched BYJU’s Wiz which is a suite of three AI models — BADRI, MathGPT, and TeacherGPT.

Future of Education

Replit CEO Amjad Masad tweeted a picture depicting the future of education — a perfect collaboration between tech and teaching.

The idea of completely eliminating teachers seems a little far-fetched. Through collaborative work with AI, teachers can adapt to the changing landscape and impart relevant knowledge to students. For example, teachers can look to utilising AI tools to support their teaching functions and to probably make it more interactive. With text-to-image generation tools such as Dall-E, Midjourney, and many more, teaching can be made creative through visual storytelling without the need to actually learn how to do it.

Creative Arts is another area where AI tech is now gaining prominence and can probably be utilised by teachers too. MusicLM, a text-to-music tool can be used to transform creative boundaries. The scope goes beyond just teaching the students. Teachers can use these AI applications to help assess and evaluate students and assist with other tasks. It not only saves time but also helps them focus on tasks that require human intervention.

The post Who Needs Teachers When You have AI? appeared first on Analytics India Magazine.

Making Predictions: A Beginner’s Guide to Linear Regression in Python

Making Predictions: A Beginner's Guide to Linear Regression in Python
Image by Author

Linear Regression is the most popular and the first machine learning algorithm that a data scientist learns while starting their data science career. It is the most important supervised learning algorithm as it sets up the building blocks for all the other advanced Machine Learning algorithms. That is why we need to learn and understand this algorithm very clearly.

In this article, we will cover Linear Regression from scratch, its mathematical & geometric intuition, and its Python implementation. The only prerequisite is your willingness to learn and the basic knowledge of Python syntax. Let’s get started.

What is Linear Regression?

Linear Regression is a Supervised Machine Learning algorithm that is used to solve Regression problems. Regression models are used to predict a continuous output based on some other factors. E.g., Predicting the next month’s stock price of an organization by considering the profit margins, total market cap, yearly growth, etc. Linear Regression can also be used in applications like predicting the weather, stock prices, sales targets, etc.

As the name suggests, Linear Regression, it develops a linear relationship between two variables. The algorithm finds the best straight line (y=mx+c) that can predict the dependent variable(y) based on the independent variables(x). The predicted variable is called the dependent or target variable, and the variables used to predict are called the independent variables or features. If only one independent variable is used, then it is called Univariate Linear Regression. Otherwise, it is called Multivariate Linear Regression.

To simplify this article, we will only take one independent variable(x) so that we can easily visualize it on a 2D plane. In the next section, we will discuss its mathematical intuition.

Mathematical Intuition

Now we will understand Linear Regression’s geometry and its mathematics. Suppose we have a set of sample pairs of X and Y values,

Making Predictions: A Beginner's Guide to Linear Regression in Python

We have to use these values to learn a function so that if we give it an unknown (x), it can predict a (y) based on the learnings. In regression, many functions can be used for prediction, but the linear function is the simplest among all.

Making Predictions: A Beginner's Guide to Linear Regression in Python
Fig.1 Sample Data Points | Image by Author

The main aim of this algorithm is to find the best-fit line among these data points, as indicated in the above figure, which gives the least residual error. The residual error is the difference between predicted and actual value.

Assumptions for Linear Regression

Before moving forward, we need to discuss some assumptions of Linear Regression that we need to be taken care of to get accurate predictions.

  1. Linearity: Linearity means that the independent and dependent variables must follow a linear relationship. Otherwise, it will be challenging to obtain a straight line. Also, the data points must be independent of each other, i.e. the data of one observation does not depend on the data of another observation.
  2. Homoscedasticity: It states that the variance of the residual errors must be constant. It means that the variance of the error terms should be constant and does not change even if the values of the independent variable change. Also, the errors in the model must follow a Normal Distribution.
  3. No Multicollinearity: Multicollinearity means there is a correlation between the independent variables. So in Linear Regression, the independent variables must not be correlated with each other.

Hypothesis Function

We will hypothesise that a linear relationship will exist between our dependent variable(Y) and the independent variable(X). We can represent the linear relationship as follows.

Making Predictions: A Beginner's Guide to Linear Regression in Python

We can observe that the straight line depends on the parameters Θ0 and Θ1. So to get the best-fit line, we need to tune or adjust these parameters. These are also called the weights of the model. And to calculate these values, we will use the loss function, also known as the cost function. It calculates the Mean Squared Error between the predicted and actual values. Our goal is to minimize this cost function. The values of Θ0 and Θ1, in which the cost function is minimized, will form our best-fit line. The cost function is represented by (J)

Making Predictions: A Beginner's Guide to Linear Regression in Python

Where,

N is the total number of samples

The squared error function is chosen to handle the negative values (i.e. if the predicted value is less than the actual value). Also, the function is divided by 2 to ease the differentiation process.

Optimizer (Gradient Descent)

Optimizer is an algorithm that minimises the MSE by iteratively updating the model's attributes like weights or learning rate to achieve the best-fit line. In Linear Regression, the Gradient Descent algorithm is used to minimize the cost function by updating the values of Θ0 and Θ1.

Making Predictions: A Beginner's Guide to Linear Regression in Python

is a hyperparameter which is called the learning rate. It determines how much our weights are adjusted with respect to the gradient loss. The value of the learning rate should be optimal, not too high or too low. If it is too high, it is difficult for the model to converge at the global minimum, and if it is too small, it takes longer to converge.

We will plot a graph between the Cost function and the Weights to find the optimum Θ0 and Θ1.

Making Predictions: A Beginner's Guide to Linear Regression in Python
Fig.2 Gradient Descent Curve | Image by GeeksForGeeks

Initially, we will assign random values to Θ0 and Θ1, then calculate the cost function and gradient. For a negative gradient(a derivative of the cost function), we need to move in the direction of increasing Θ1 in order to reach the minima. And for a positive gradient, we must move backwards to reach the global minima. We aim to find a point at which the gradient almost equals zero. At this point, the value of the cost function is minimum.

By now, you have understood the working and mathematics of Linear Regression. The following section will see how to implement it from scratch using Python on a sample dataset.

Linear Regression Python Implementation

In this section, we will learn how to implement the Linear Regression algorithm from scratch only using fundamental libraries like Numpy, Pandas, and Matplotlib. We will implement Univariate Linear Regression, which contains only one dependent and one independent variable.

The dataset we will use contains about 700 pairs of (X, Y) in which X is the independent variable and Y is the dependent variable. Ashish Jangra contributes this dataset, and you can download it from here.

Importing Libraries

# Importing Necessary Libraries  import pandas as pd  import numpy as np  import matplotlib.pyplot as plt  import matplotlib.axes as ax  from IPython.display import clear_output

Pandas reads the CSV file and gets the dataframe, while Numpy performs basic mathematics and statistics operations. Matplotlib is responsible for plotting graphs and curves.

Loading the Dataset

# Dataset Link:  # https://github.com/AshishJangra27/Machine-Learning-with-Python-GFG/tree/main/Linear%20Regression    df = pd.read_csv("lr_dataset.csv")  df.head()    # Drop null values  df = df.dropna()    # Train-Test Split  N = len(df)  x_train, y_train = np.array(df.X[0:500]).reshape(500, 1), np.array(df.Y[0:500]).reshape(      500, 1  )  x_test, y_test = np.array(df.X[500:N]).reshape(N - 500, 1), np.array(      df.Y[500:N]  ).reshape(N - 500, 1)

First, we will get the dataframe df and then drop the null values. After that, we will split the data into training and testing x_train, y_train, x_test and y_test.

Building Model

class LinearRegression:      def __init__(self):          self.Q0 = np.random.uniform(0, 1) * -1  # Intercept          self.Q1 = np.random.uniform(0, 1) * -1  # Coefficient of X          self.losses = []  # Storing the loss of each iteration        def forward_propogation(self, training_input):          predicted_values = np.multiply(self.Q1, training_input) + self.Q0  # y = mx + c          return predicted_values        def cost(self, predictions, training_output):          return np.mean((predictions - training_output) ** 2)  # Calculating the cost        def finding_derivatives(self, cost, predictions, training_input, training_output):          diff = predictions - training_output          dQ0 = np.mean(diff)  # d(J(Q0, Q1))/d(Q0)          dQ1 = np.mean(np.multiply(diff, training_input))  # d(J(Q0, Q1))/d(Q1)          return dQ0, dQ1        def train(self, x_train, y_train, lr, itrs):          for i in range(itrs):              # Finding the predicted values (Using the linear equation y=mx+c)              predicted_values = self.forward_propogation(x_train)                # Calculating the Loss              loss = self.cost(predicted_values, y_train)              self.losses.append(loss)                # Back Propagation (Finding Derivatives of Weights)              dQ0, dQ1 = self.finding_derivatives(                  loss, predicted_values, x_train, y_train              )                # Updating the Weights              self.Q0 = self.Q0 - lr * (dQ0)              self.Q1 = self.Q1 - lr * (dQ1)                # It will dynamically update the plot of the straight line              line = self.Q0 + x_train * self.Q1              clear_output(wait=True)              plt.plot(x_train, y_train, "+", label="Actual values")              plt.plot(x_train, line, label="Linear Equation")              plt.xlabel("Train-X")              plt.ylabel("Train-Y")              plt.legend()              plt.show()          return (              self.Q0,              self.Q1,              self.losses,          )  # Returning the final model weights and the losses

We have created a class named LinearRegression() in which all the required functions are built.

__init__ : It is a constructor and will initialize the weights with random values when the object of this class is created.

forward_propogation(): This function will find the predicted output using the equation of the straight line.

cost(): This will calculate the residual error associated with the predicted values.

finding_derivatives(): This function calculates the derivative of the weights, which can later be used to update the weights for minimum errors.

train(): This function will take input from the training data, learning rate and the total number of iterations. It will update the weights using back-propagation until the specified number of iterations. At last, it will return the weights of the best-fit line.

Training the Model

lr = 0.0001  # Learning Rate  itrs = 30  # No. of iterations  model = LinearRegression()  Q0, Q1, losses = model.train(x_train, y_train, lr, itrs)    # Output No. of Iteration vs Loss  for itr in range(len(losses)):      print(f"Iteration = {itr+1}, Loss = {losses[itr]}")

Output:

Iteration = 1, Loss = 6547.547538061649  Iteration = 2, Loss = 3016.791083711492  Iteration = 3, Loss = 1392.3048668536044  Iteration = 4, Loss = 644.8855797373262  Iteration = 5, Loss = 301.0011032250385  Iteration = 6, Loss = 142.78129818453215  .  .  .  .  Iteration = 27, Loss = 7.949420840198964  Iteration = 28, Loss = 7.949411555664398  Iteration = 29, Loss = 7.949405538972356  Iteration = 30, Loss = 7.949401025888949

You can observe that in the 1st iteration, the loss is maximum, and in the subsequent iterations, this loss decreases and reaches its minimum value at the end of the 30th iteration.

Making Predictions: A Beginner's Guide to Linear Regression in Python
Fig.3 Finding Best-fit Line | Image by Author

The above gif indicates how the straight line reaches its best-fit line after completing the 30th iteration.

Final Prediction

# Prediction on test data  y_pred = Q0 + x_test * Q1  print(f"Best-fit Line: (Y = {Q1}*X + {Q0})")    # Plot the regression line with actual data pointa  plt.plot(x_test, y_test, "+", label="Data Points")  plt.plot(x_test, y_pred, label="Predited Values")  plt.xlabel("X-Test")  plt.ylabel("Y-Test")  plt.legend()  plt.show()

This is the final equation of the best-fit line.

Best-fit Line: (Y = 1.0068007107347927*X + -0.653638673779529)

Making Predictions: A Beginner's Guide to Linear Regression in Python
Fig.4 Actual vs Predicted Output | Image by Author

The above plot shows the best-fit line (orange) and actual values (blue +) of the test set. You can also tune the hyperparameters, like the learning rate or the number of iterations, to increase the accuracy and precision.

Linear Regression (Using Sklearn Library)

In the previous section, we have seen how to implement Univariate Linear Regression from scratch. But there is also a built-in library by sklearn that can be directly used to implement Linear Regression. Let’s briefly discuss how we can do it.

We will use the same dataset, but if you want, you can use a different one also. You need to import two extra libraries as follows.

# Importing Extra Libraries  from sklearn.linear_model import LinearRegression  from sklearn.model_selection import train_test_split

Loading Dataset

df = pd.read_csv("lr_dataset.csv")    # Drop null values  df = df.dropna()    # Train-Test Split  Y = df.Y  X = df.drop("Y", axis=1)  x_train, x_test, y_train, y_test = train_test_split(      X, Y, test_size=0.25, random_state=42  )

Earlier, we had to perform the train-test split using the numpy library manually. But now we can use sklearn's train_test_split() to directly divide the data into the training and testing sets just by specifying the testing size.

Model Training and Predictions

model = LinearRegression()  model.fit(x_train, y_train)  y_pred = model.predict(x_test)    # Plot the regression line with actual data points  plt.plot(x_test, y_test, "+", label="Actual values")  plt.plot(x_test, y_pred, label="Predicted values")  plt.xlabel("X")  plt.ylabel("Y")  plt.legend()  plt.show()

Now, we don’t have to write the codes for forward propagation, backward propagation, cost function, etc. We can now directly use the LinearRegression() class and train the model on the input data. Below is the plot obtained on the test data from the trained model. The results are similar to when we implemented the algorithm on our own.

Making Predictions: A Beginner's Guide to Linear Regression in Python
Fig.5 Sklearn Model Output | Image by Author

References

  1. GeeksForGeeks: ML Linear Regression

Wrapping it Up

Google Colab Link for the Complete Code — Linear Regression Tutorial Code

In this article, we have thoroughly discussed what Linear Regression is, its mathematical intuition and its Python implementation both from scratch and from using sklearn’s library. This algorithm is straightforward and intuitive, so it helps beginners to lay a solid foundation as well as helps to gain practical coding skills to make accurate predictions using Python.

Thanks for reading.
Aryan Garg is a B.Tech. Electrical Engineering student, currently in the final year of his undergrad. His interest lies in the field of Web Development and Machine Learning. He have pursued this interest and am eager to work more in these directions.

More On This Topic

  • Your Guide to Linear Regression Models
  • A Beginner’s Guide to Web Scraping Using Python
  • Comparing Linear and Logistic Regression
  • Linear Regression for Data Science
  • Linear vs Logistic Regression: A Succinct Explanation
  • A Beginner's Guide to Q Learning

The Rise and Rise of AI Agents

The AI agent wave that began with Auto GPT and AgentGPT has now become one of the most interesting facets of modern AI innovation. These so-called agents use LLMs to autonomously complete tasks, with many calling them the precursors of AGI.

Moreover, with the introduction of function calling in OpenAI’s APIs, deploying models with agentic behaviour is now easier than ever. Bringing together the power of GPT-4 with custom-written automation programs has created a whole new crop of AI agents, including some that might change the way we interact with the web.

With the recent development in the ecosystem surrounding AI agents, such as the function calling update, as well as improvements to LangChain, these agents are becoming more and more powerful. Now, new agents can go beyond creating hustle strategies — they can generate entire codebases and write multi-chapter novels in a matter of minutes. With the rise in accompanying infrastructure and plumbing, we are seeing a new crop of super-powerful AI agents.

Building on a legacy

Simply put, AI agents use the natural language processing capabilities of LLMs to autonomously accomplish a given task. Seeing the potential of AI agents, market leaders like OpenAI and Hugging Face slowly began building the ecosystem around them. For example, LangChain, which enabled an early form of agentic behaviour by connecting LLMs with external data, has now fleshed out its function calling features.

With this update, LangChain has not only added support for OpenAI’s function calling, but also the ability to convert LangChain tools to functions. This enables a wide variety of use-cases, opening up the ability to combine LLMs with even more programs.

One of the most remarkable new AI agents is GPT Engineer, a collection of AI systems that can build an entire system from scratch. According to its GitHub page, it can generate an entire codebase based on a prompt and some clarification. What’s more, the agent will even remember the feedback given by the human over time. The repo has around 24.4k stars at the time of writing.

Similarly, programmer Matt Shumer created an agent called GPT-Author. This collection of AI models can write an entire book in just minutes, and even generate a fitting cover art and publish to Kindle. While this has already raised concerns, the product has been open-sourced, allowing it to be plugged into even more systems if need be. Shumer stated, “gpt-author is a constrained agent — meaning its behaviour is highly-controlled, leading to better results than open-ended agents.”

This could be the key towards creating AI agents that actually fulfil a goal faster and more efficient than a human can. AI agents are often criticised for being inherently iterative, meaning that they cannot create something creatively new like humans can. However, constrained AI agents seem to be able to reach human-like levels while reducing errors and staying on topic.

The past and future of AI agents

Mustafa Suleyman, the co-founder of DeepMind, has stated in interviews that narrow-minded AIs are better suited for constrained use-cases. Speaking about his company’s new AI product, Pi, he stated,

“Because we don’t do things like code generation…poems, legal letters, and song sheets, we can basically free up a lot of the language model to focus just on general knowledge, trivia, and a conversational style,”

The AI agent trend arguably began with AutoGPT, launched in March this year. The GitHub repo quickly garnered over 100,000 stars, receiving rave reviews from the likes of Andrej Karpathy.

Hailed as the “next frontier of prompt engineering”, AI agents began to grow in popularity. Developers used AutoGPT to automate data scraping, to write and self-debug code, and even find ways to hustle on the Internet to make some extra money. The success of AutoGPT resulted in a bunch of other AI agents emerging, such as AgentGPT, AutoGPT, Do Anything Machine, and more.

A look at LangChain’s Twitter feed shows how much functionality this update has added. Developers have created bots that can pull from GitHub repos to answer questions, a service to create websites from a sketch, and even a smart database for farmers.

When combined with the updated and cheaper OpenAI API, AI agents have created a buzz in the developer community. It now seems that developers are more eager to play with LLMs, resulting in some interesting agents being released.

This might be the path to AI agents that we can actually use. Similar to Tim Berners-Lee’s prediction that everyone will each have their own AI assistants in the future, a collection of constrained AI agents might become the way we interact with the web.

The post The Rise and Rise of AI Agents appeared first on Analytics India Magazine.

Top 6 Papers Presented by Meta at CVPR 2023

CVPR 2023 saw interesting research papers at the forefront of computer vision. The event presented an array of contributions from Meta, encompassing a diverse range of topics including video understanding, video-language embeddings, object detection, reinforcement learning, and image similarity.

Let us take a look at the remarkable papers presented by Meta, which introduce cutting-edge models, frameworks, approaches, techniques, and benchmarks, all aimed at enhancing the performance and scalability of computer vision systems. Larry Zitnick, senior research scientist in the Fundamental AI Research (FAIR) team at Meta AI, is the keynote speaker.

Read more: Top 9 Papers Presented at Google CVPR 2023

Egocentric Video Task Translation

The paper discusses the limitations of treating different video understanding tasks in isolation and proposes a unified approach called EgoTask Translation (EgoT2) for wearable cameras. EgoT2 uses separate task-specific models and a shared task translator to improve performance on multiple tasks simultaneously. The authors demonstrate the effectiveness of EgoT2 on various video tasks and achieve top-ranked results in benchmark challenges. Two variants of EgoT2, EgoT2-s and EgoT2-g, are introduced, with EgoT2-s focusing on translating auxiliary task features into predictions for the primary task, and EgoT2-g conducting task translation for multiple tasks concurrently. The authors provide qualitative analysis showcasing how auxiliary tasks contribute to the primary task prediction. The experiments are conducted on a diverse set of egocentric video tasks from the Ego4D dataset.

Learning Video Representations from Large Language Models

In this paper, we get to know about LaViLa, a new method for learning video-language representations using LLMs. By repurposing pre-trained LLMs to incorporate visual input, and fine-tuning them, automatic video narrators are created. These auto-generated narrations offer several advantages, such as comprehensive coverage of lengthy videos, improved synchronisation of visual information and text, and increased text diversity. The video-text embedding, which is learned through contrastive methods using these narrations, surpasses the previous state-of-the-art for both first-person and third-person video tasks. This improvement is observed in both zero-shot and finetuned scenarios, with LaViLa achieving notable absolute gains of 10.1% on EGTEA classification and 5.9% on Epic-Kitchens-100 multi-instance retrieval benchmarks. Moreover, even when trained on only half the narrations from the Ego4D dataset, LaViLa outperforms baseline models trained on the entire set, demonstrating positive scaling behavior with larger pre-training data and model size.

📺 Learning Video Representations from Large Language Models
This work repurposed pre-trained LLMs to be conditioned on visual input, and finetune them to create automatic video narrators.
Paper ➡ https://t.co/OsZt3AnAEM
3/7 pic.twitter.com/DLunz5bcgP

— Meta AI (@MetaAI) June 20, 2023

PACO: Parts and Attributes of Common Objects

PACO, a dataset focusing on object models, offers detailed descriptions and goes beyond traditional object masks by including part masks and attributes. It covers 75 object categories, 456 object part categories, and 55 attributes in both image (LVIS) and video (Ego4D) datasets. With 641K part masks annotated across 260K object boxes, PACO provides extensive attribute annotations for about half of them. Evaluation metrics and benchmark results are provided for three dataset tasks: part mask segmentation, object and part attribute prediction, and zero-shot instance detection. The introduction of PACO aims to facilitate research on joint detection of objects, parts, and attributes, presenting unique challenges compared to traditional object detection tasks.

Galactic: Scaling End-to-End Reinforcement Learning for Rearrangement at 100k Steps-per-Second

Galactic is a comprehensive framework for simulating and applying reinforcement learning (RL) to robotic mobile manipulation in indoor settings. The framework centers around a Fetch robot equipped with various features and tasks with rearranging objects within a home environment. Galactic boasts remarkable speed, achieving 421,000 steps-per-second (SPS) in simulation speed, rendering and physics combined, on an 8-GPU node. This is a 54-fold improvement over Habitat 2.0. Moreover, Galactic is designed to optimise the entire process, including rendering, physics, RL inference, and learning, achieving over 108,000 SPS, an 88-fold increase over Habitat 2.0. These significant speed enhancements lead to reduced training time and enable large-scale experiments. For instance, Galactic achieves a mobile pick skill accuracy of over 80% in under 16 minutes, a 100-fold acceleration compared to Habitat 2.0. Additionally, it enables a groundbreaking rearrangement experiment using 5 billion steps of experience within 46 hours, equivalent to 20 years of robot experience. A single neural network, comprising task-agnostic components, achieves an impressive 85% success rate in GeometricGoal rearrangement, in contrast to Habitat 2.0’s 0% success rate.

GeneCIS: A Benchmark for General Conditional Image Similarity

The paper introduces the GeneCIS benchmark, which evaluates models’ ability to adapt to various similarity conditions in a zero-shot setting. The benchmark focuses on an open-set of similarity conditions, allowing for a broader evaluation. The study reveals that powerful CLIP models struggle with GeneCIS and that performance on the benchmark is only weakly correlated with accuracy on ImageNet. This suggests that simply scaling existing methods is not effective. To address this, the authors propose a simple and scalable solution that involves mining information from image-caption datasets. This approach significantly improves performance on GeneCIS and enhances zero-shot performance on other image retrieval benchmarks. Even though the model is evaluated in a zero-shot manner, it outperforms state-of-the-art supervised models on MIT-States.

HierVL: Learning Hierarchical Video-Language Embeddings

HierVL is a novel approach to video-language embeddings that addresses the limitations of existing methods by considering both short-term and long-term associations. By utilizing videos accompanied by timestamped text descriptions and high-level summaries, HierVL introduces a hierarchical contrastive training objective to achieve alignment between text and visual elements at both the clip and video levels. This approach captures not only the immediate actions depicted in each video clip but also the broader context and intent behind the activity. HierVL surpasses single-level representations in terms of clip-level performance and achieves state-of-the-art results in long-term video modeling tasks. Moreover, it demonstrates successful transferability to various challenging downstream tasks in different datasets, including EPIC-KITCHENS-100, Charades-Ego, and HowTo100M, with both zero-shot and fine-tuned settings.

Read more: While My AI Gently Weeps – A New Beatles Finale!

The post Top 6 Papers Presented by Meta at CVPR 2023 appeared first on Analytics India Magazine.

HPE Discover 2023: GreenLake enters the AI market with LLM cloud service

Conceptual technology illustration of artificial intelligence and edge computing.
Image: kras99/Adobe Stock

The new supercomputing cloud service GreenLake for Large Language Models will be available in late 2023 or early 2024 in the U.S., Hewlett Packard Enterprise announced at HPE Discover on Tuesday. GreenLake for LLMs will allow enterprises to train, tune and deploy large-scale artificial intelligence that is private to each individual business.

GreenLake for LLMs will be available to European customers following the U.S. release, with an anticipated release window in early 2024.

Jump to:

  • HPE partners with AI software startup Aleph Alpha
  • HPE’s Cray XD supercomputers enable enterprise AI performance
  • Getting more power out of renewable energy
  • Alternatives to HPE GreenLake for LLMs

HPE partners with AI software startup Aleph Alpha

“AI is at an inflection point, and at HPE we are seeing demand from various customers beginning to leverage generative AI,” said Justin Hotard, executive vice president and general manager for HPC & AI Business Group and Hewlett Packard Labs, in a virtual presentation.

GreenLake for LLMs runs on an AI-native architecture spanning hundreds or thousands of CPUs or GPUs, depending on the workload. This flexibility within one AI-native architecture offering makes it more efficient than general-purpose cloud options that run multiple workloads in parallel, HPE said. GreenLake for LLMs was created in partnership with Aleph Alpha, a German AI startup, which provided a pre-trained LLM called Luminous. The Luminous LLM can work in English, French, German, Italian and Spanish and can use text and images to make predictions.

The collaboration went both ways, with Aleph Alpha using HPE infrastructure to train Luminous in the first place.

“By using HPE’s supercomputers and AI software, we efficiently and quickly trained Luminous,” said Jonas Andrulis, founder and CEO of Aleph Alpha, in a press release. “We are proud to be a launch partner on HPE GreenLake for Large Language Models, and we look forward to expanding our collaboration with HPE to extend Luminous to the cloud and offer it as-a-service to our end customers to fuel new applications for business and research initiatives.”

The initial launch will include a set of open-source and proprietary models for retraining or fine-tuning. In the future, HPE expects to provide AI specialized for tasks related to climate modeling, healthcare, finance, manufacturing and transportation.

For now, GreenLake for LLMs will be part of HPE’s overall AI software stack (Figure A), which includes the Luminous model, machine learning development, data management and development programs, and the Cray programming environment.

Figure A

An illustration of HPE’s AI software stack.
An illustration of HPE’s AI software stack. Image: HPE

HPE’s Cray XD supercomputers enable enterprise AI performance

GreenLake for LLM runs on HPE’s Cray XD supercomputers and NVIDIA H100 GPUs. The supercomputer and HPE Cray Programming Environment allow developers to do data analytics, natural language tasks and other work on high-powered computing and AI applications without having to run their own hardware, which can be costly and require expertise specific to supercomputing.

Large-scale enterprise production for AI requires massive performance resources, skilled people, and security and trust, Hotard pointed out during the presentation.

SEE: NVIDIA offers AI tenancy on its DGX supercomputer.

Getting more power out of renewable energy

By using a colocation facility, HPE aims to power its supercomputing with 100% renewable energy. HPE is working with a computing center specialist, QScale, in North America on a design built specifically for this purpose.

“In all of our cloud deployments, the objective is to provide a 100% carbon-neutral offering to our customers,” said Hotard. “One of the benefits of liquid cooling is you can actually take the wastewater, the heated water, and reuse it. We have that in other supercomputer installations, and we’re leveraging that expertise in this cloud deployment as well.”

Alternatives to HPE GreenLake for LLMs

Other cloud-based services for running LLMs include NVIDIA’s NeMo (which is currently in early access), Amazon Bedrock, and Oracle Cloud Infrastructure.

Hotard noted in the presentation that GreenLake for HPE will be a complement to, not a replacement for, large cloud services like AWS and Google Cloud Platform.

“We can and intend to integrate with the public cloud. We see this as a complimentary offering; we don’t see this as a competitor,” he said.

Subscribe to the Innovation Insider Newsletter

Catch up on the latest tech innovations that are changing the world, including IoT, 5G, the latest about phones, security, smart cities, AI, robotics, and more.

Delivered Tuesdays and Fridays Sign up today