Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 17

ARTIFICIAL INTELLIGENCE

Simple Linear Regression


Feb 05, 2024

Students Instructor
M. Ahmad Mr. Shahzad sarwar
Asif Husain
Waseem Akram
Talha Shabbir
Introduction to artificial intelligence
Artificial intelligence applications are all around us, but what does it really mean? In this article,
Kumar Abhishek explains the history and progress of artificial intelligence.

Artificial intelligence (AI) is the ability of machines to replicate or enhance human intellect, such
as reasoning and learning from experience. Artificial intelligence has been used in computer
programs for years, but it is now applied to many other products and services. For example,
some digital cameras can determine what objects are present in an image using artificial
intelligence software. In addition, experts predict many more innovative uses for artificial
intelligence in the future, including smart electric grids.

AI uses techniques from probability theory, economics, and algorithm design to solve practical
problems. In addition, the AI field draws upon computer science, mathematics, psychology, and
linguistics. Computer science provides tools for designing and building algorithms, while
mathematics offers tools for modeling and solving the resulting optimization problems.

Although the concept of AI has been around since the 19th century, when Alan Turing first
proposed an “imitation game” to assess machine intelligence, it only became feasible to achieve
in recent decades due to the increased availability of computing power and data to train AI
systems.

To understand the idea behind AI, you should think about what distinguishes human intelligence
from that of other creatures – our ability to learn from experiences and apply these lessons to
new situations. We can do this because of our advanced brainpower; we have more neurons than
any animal

Application of AI
Artificial Intelligence has various applications in today's society. It is
becoming essential for today's time because it can solve complex problems
with an efficient way in multiple industries, such as Healthcare,
entertainment, finance, education, etc. AI is making our daily life more
comfortable and fast.

Following are some sectors which have the application of Artificial


Intelligence:
AI in Healthcare

o In the last, five to ten years, AI becoming more advantageous for the
healthcare industry and going to have a significant impact on this
industry.

o Healthcare Industries are applying AI to make a better and faster


diagnosis than humans. AI can help doctors with diagnoses and can
inform when patients are worsening so that medical help can reach to
the patient before hospitalization.

AI in Gaming
ADVERTISEMENT

o AI can be used for gaming purpose. The AI machines can play


strategic games like chess, where the machine needs to think of a
large number of possible places.

AI in Data Security
ADVERTISEMENT

o The security of data is crucial for every company and cyber-attacks are
growing very rapidly in the digital world. AI can be used to make your
data more safe and secure. Some examples such as AEG bot, AI2
Platform,are used to determine software bug and cyber-attacks in a
better way.

AI in Social Media

o Social Media sites such as Facebook, Twitter, and Snapchat contain


billions of user profiles, which need to be stored and managed in a
very efficient way. AI can organize and manage massive amounts of
data. AI can analyze lots of data to identify the latest trends, hashtag,
and requirement of different users.

History of Artificial Intelligence

Birth of AI: 1950-1956


This range of time was when the interest in AI really came to a head. Alan Turing
published his work “Computer Machinery and Intelligence” which eventually became
The Turing Test, which experts used to measure computer intelligence. The term
“artificial intelligence” was coined and came into popular use.

Dates of note:
 1950: Alan Turing published “Computer Machinery and Intelligence” which
proposed a test of machine intelligence called The Imitation Game.

 1952: A computer scientist named Arthur Samuel developed a program to play


checkers, which is the first to ever learn the game independently.

 1955: John McCarthy held a workshop at Dartmouth on “artificial intelligence”


which is the first use of the word, and how it came into popular usage.

Artificial General Intelligence: 2012-present


That brings us to the most recent developments in AI, up to the present day. We’ve seen
a surge in common-use AI tools, such as virtual assistants, search engines, etc. This time
period also popularized Deep Learning and Big Data..

Notable dates include:

 2012: Two researchers from Google (Jeff Dean and Andrew Ng) trained a neural
network to recognize cats by showing it unlabeled images and no background
information.

 2015: Elon Musk, Stephen Hawking, and Steve Wozniak (and over 3,000 others)
signed an open letter to the worlds’ government systems banning the
development of (and later, use of) autonomous weapons for purposes of war.

 2016: Hanson Robotics created a humanoid robot named Sophia, who became
known as the first “robot citizen” and was the first robot created with a realistic
human appearance and the ability to see and replicate emotions, as well as to
communicate.

 2017: Facebook programmed two AI chatbots to converse and learn how to


negotiate, but as they went back and forth they ended up forgoing English and
developing their own language, completely autonomously.

 2018: A Chinese tech group called Alibaba’s language-processing AI beat human


intellect on a Stanford reading and comprehension test.

 2019: Google’s AlphaStar reached Grandmaster on the video game StarCraft 2,


outperforming all but .2% of human players.

 2020: OpenAI started beta testing GPT-3, a model that uses Deep Learning to
create code, poetry, and other such language and writing tasks. While not the
first of its kind, it is the first that creates content almost indistinguishable from
those created by humans.
 2021: OpenAI developed DALL-E, which can process and understand images
enough to produce accurate captions, moving AI one step closer to
understanding the visual world.

What does the future hold?


Now that we’re back to the present, there is probably a natural next question on your
mind: so what comes next for AI?

Well, we can never entirely predict the future. However, many leading experts talk about
the possible futures of AI, so we can make educated guesses. We can expect to see
further adoption of AI by businesses of all sizes, changes in the workforce as more
automation eliminates and creates jobs in equal measure, more robotics, autonomous
vehicles, and so much more.

Turing Test
Introduction

In this assignment, we will explore the concept of the Turing Test, a benchmark for evaluating a
machine's ability to exhibit intelligent behavior indistinguishable from that of a human.

Background

The Turing Test was proposed by Alan Turing in 1950 as a way to determine if a machine can
demonstrate human-like intelligence through natural language conversation.

The Turing Test is a deceptively simple method of determining whether a machine can demonstrate
human intelligence: If a machine can engage in a conversation with a human without being detected as
a machine, it has demonstrated human intelligence.Can machine think just like human?

History of the Turing Test

Alan Turing developed some of the basic concepts of computer science while searching for a more
efficient method of breaking coded German messages during World War II. After the war, he began
thinking about artificial intelligence.4 In his 1950 paper, Turing began by posing the question, “Can
machines think?” He then proposed a test that is meant to help humans answer the question.

Imitation Game
One of the earlier applications of the Turing test, the imitation game version often utilizes three parties.
The first person was a male, the second person was a female, and the third person was responsible for
determining the gender of the first two people. The first person is often tasked with trying to trick the
third person, while the second person is often tasked with trying to help the third person correctly
identify each gender.

Future iterations of the imitation game have evolved into both parties attempting to trick the third
person into incorrectly identifying the genders. In any case, the objective of the imitation game is to
determin

Objectives

1. Understand the principles of the Turing Test.

2. Evaluate the implications of successful Turing Test performance.

3. Discuss the limitations and criticisms of the Turing Test.

Methodology

Students will engage in conversations with AI models and assess their ability to mimic human responses.
Analyze the strengths and weaknesses of the AI systems.

The Turing Test Today

The Turing Test has its detractors, but it remains a measure of the success of artificial intelligence
projects. An updated version of the Turing Test has more than one human judge interrogating and
chatting with both subjects. The project is considered a success if more than 30% of the judges, after five
minutes of conversation, conclude that the computer is a human.

Conclusion

Summarize findings, reflect on the significance of the Turing Test in the field of artificial intelligence, and
consider potential future developments in assessing machine intelligence.

Types of AI

Machine act as human being.

Or-

AI, or artificial intelligence, refers to the development of computer systems that can perform tasks that
typically require human intelligence. These tasks include learning, reasoning, problem-solving,
perception, and language understanding.
What is Weak AI?

Weak AI, often known as narrow AI, is a category of artificial intelligence confined to a singular or limited
domain. Weak AI mimics human thought processes. By performing time-consuming operations and
conducting data analysis through methods that people can’t always use, this technology can be
advantageous to society.

It concentrates on tasks such as responding to user input searches or playing games. Human
intervention depends on specifying the learning algorithm’s parameters and supplying the appropriate
training data to assure correctness.

It cannot break the rules; it just adheres to them and is constrained by them. Weak AI helps convert
enormous amounts of data into useful information by identifying patterns and generating predictions.

What is Strong AI?

Strong AI, also known as artificial general intelligence (AGI) or deep AI, is a computer system with a
comprehensive intellect capable of learning and employing its intellectual ability to solve any problem.

It can understand, work and have a thought process different from humans in certain situations. Strong
AI uses an understanding of mind AI framework to understand the goals, motivations, standards, and
cognitive processes that govern other intelligent beings.

Although it is in its early years, when it comes to weak AI vs strong AI, strong AI contends a lot of
potential because of recent developments in nanotechnology. It is also a possible application for
creating an artificial neural network that can function similarly to a human beingComparison of Weak
and Strong AI

Did you know that the clever chess-playing computer, Deep Blue, and Siri, the helpful voice assistant on
your phone, are both examples of Weak AI? They may be impressive, but they’re designed for specific
tasks and can’t handle anything outside their programming.

Weak AI, often known as narrow AI, is a category of artificial intelligence confined to a singular or limited
domain. Weak AI mimics human thought processes. By performing time-consuming operations and
conducting data analysis through methods that people can’t always use, this technology can be
advantageous to society.

It concentrates on tasks such as responding to user input searches or playing games. Human
intervention depends on specifying the learning algorithm’s parameters and supplying the appropriate
training data to assure correctness.

It cannot break the rules; it just adheres to them and is constrained by them. Weak AI helps convert
enormous amounts of data into useful information by identifying patterns and generating predictions.

What is Strong AI?

Strong AI, like a smart character from a sci-fi movie, could think, learn, and perform tasks just like
humans. On the other hand, Weak AI, the kind we encounter daily, focuses on doing one job well, such
as recommending movies, giving us directions, or even helping us pick the perfect playlist.

What is Weak AI?

Did you know that the clever chess-playing computer, Deep Blue, and Siri, the helpful voice assistant on
your phone, are both examples of Weak AI? They may be impressive, but they’re designed for specific
tasks and can’t handle anything outside their programming.

Strong AI, also known as artificial general intelligence (AGI) or deep AI, is a computer system with a
comprehensive intellect capable of learning and employing its intellectual ability to solve any problem.

It can understand, work and have a thought process different from humans in certain situations. Strong
AI uses an understanding of mind AI framework to understand the goals, motivations, standards, and
cognitive processes that govern other intelligent beings.

Although it is in its early years, when it comes to weak AI vs strong AI, strong AI contends a lot of
potential because of recent developments in nanotechnology. It is also a possible application for
creating an artificial neural network that can function similarly to a human being.

Applications of Weak AI

When it comes to the question ofweak AI vs strong AI, weak AI has more applications in different
disciplines because of its easy-to-create ability. Some of the applications of weak AI are as follows:

1. Natural Language Processing


NLPis a branch of AI that studies how computers and languages people speak interact. NLP employs
weak or narrow AI systems to perform sentiment assessment, text production, and translating
languages.

2. Financial Sector

In the finance sector, artificial intelligence is utilized for projects like credit assessment, identifying
fraudulent transactions, managing portfolios, and forecasting financial results.

3. Robotics

Robotics uses weak AI to guide the motion and behavior of its machines. This covers grasping,
establishing a path, and recognizing objects (valuable for automating business processes).

Reference
 https://www.tableau.com/data-insights/ai/history#:~:text=Birth%20of%20AI%3A
%201950%2D1956&text=into%20popular%20use.-,Dates%20of%20note%3A,ever%20learn
%20the%20game%20independently.
 https://www.simplilearn.com/tutorials/artificial-intelligence-tutorial/types-of-artificial-
intelligence
 https://www.javatpoint.com/application-of-ai
 https://www.red-gate.com/simple-talk/development/data-science-development/introduction-
to-artificial-intelligence/

PART-2

A Practical to Simple Linear Regression Using Python


So, let’s get familiarized with the terms to be used:
Machine Learning (ML): ML is an application of Artificial Intelligence (AI) that provides
systems the ability to automatically learn themselves and improve from the experience
without being explicitly programmed. ML focuses on the development of computer
programs that can access data and use it to self-learn.

Supervised Learning: The model is trained using ‘labeled data’. Datasets are said to
contain labels that contain both input and output parameters. Supervised learning is a
category of machine learning that uses labeled datasets to train algorithms to predict
outcomes and recognize patterns. Supervised learning algorithms are given labeled training
to learn the relationship between the input and the outputs.

Simple Linear Regression: It is a Regression Model that estimates the relationship


between the independent variable and the dependent variable using a straight line

[y = mx + c]

Where both the variables should be quantitative.

Models: Those are output by algorithms and are comprised of model data and a
prediction algorithm.

What are the Steps in Simple Linear Regression:


 Import Libraries
 Prepare Data
 Split Data
 Train Model
 Make Predictions
 Evaluate Model
 Use for Predictions
Step-1: import libraries
Input:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
import seaborn as sns
from sklearn.metrics import mean_squared_error, r2_score

Purpose
 import numpy as np: making all of its functions and classes available for use in your
Python script or program.
 import pandas as pd: Read .csv file. Pandas is a powerful library for data manipulation
and analysis. By using the alias. Pandas provides powerful tools for data cleaning,
exploration, and analysis.
 import matplotlib.pyplot as plt: which is a popular plotting library for creating 2D and
3D plots and visualizations.
 from sklearn.model_selection import train_test_split: Python is commonly used for
splitting a dataset into two subsets: one for training a machine learning model and the
other for testing or validating the model.
 from sklearn.linear_model import LinearRegression: used for implementing linear
regression models. The goal is to find the best-fitting linear relationship between the
independent variables (features) and the dependent variable (target).
 import seaborn as sns: The seaborn library in Python is a data visualization library
based on Matplotlib. It provides a high-level interface for creating attractive and
informative statistical graphics. Seaborn comes with several built-in themes and color
palettes that enhance the aesthetics of plots.
 from sklearn.metrics import mean_squared_error, r2_score: This function calculates
the mean squared error (MSE) between the predicted values and the actual (true)
values.

Step-2: Loading Dataset


Input:
data=pd.read_csv('C:\\Users\HP\Desktop\Advertising.csv')
Purpose:

The purpose of this line of code is to load the data from the CSV file into a DataFrame named
data, making it accessible for further analysis, exploration, and manipulation using pandas
library.

Step-3: Looking into the dataset

Input:

data.head ()

Output:

Purpose:
The head() method is used to display the first few rows of a DataFrame.

Step-4: Exploratory data Analysis


Input:
a = data.describe () # returns a data frame containing basic stats
b=a.get ('TV')

print(b)

Output:

Input:
sns.pairplot (data, x_vars = ['TV', 'Newspaper', 'Radio'], y_vars='Sales', kind = 'scatter')
plt.show()

Output:

Input:
plt.figure (figsize=(10,8))
sns.heatmap(data.corr(), annot=True, cmap = 'coolwarm', square = True)
plt.show()
Output:

Step-5: Tranining
Input:
X=data['TV'].values.reshape (-1,1)
Y=data['Sales'].values.reshape (-1,1)

X_train, X_test, y_train, y_test = train_test_split (X, Y, test_size = 0.3, random_state = 100)

model.fit (X_train, y_train)

model = LinearRegression ()
Output:

Step-6:Prediction
Input:
y_pred = model.predict (X_test)

Step-7: Evaluation
Input:
mse = mean_squared_error (y_test, y_pred)
r2 = r2_score (y_test, y_pred

print ('Mean Squared Error:', mse)


print ('R^2 Score:', r2)

Output:

Step-8: Plotting
Input:
plt.scatter (X, Y, s=50, alpha = 0.5, label = 'Data')
plt.plot (X_test, y_pred, color = 'red', label = 'Linear Regression')
plt.xlabel ('TV marketing')
plt.ylabel ('Sales')
plt.legend()
plt.show()

Output:

You might also like