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

Government of Karnataka

Department of Technical Education

VISVESVARAYA TECHNOLOGICAL UNIVERSITY


BELAGAVI -590018

INTERNSHIP REPORT
On
“AIML with Python”
Submitted in partial fulfilment for the award of degree

BACHELOR OF ENGINEERING IN COMPUTER SCIENCE ENGINEERING

Submitted by:
ANISHA F KURUBAGOND
USN: - 2GO21CS004

Under the Guidance of:


External Guide: Abhishek K
Internal Guide: Miss. Afreen Banu

Conducted at
FARMER COIN

Department of CSE
Government Engineering College
HAVERI-581110
Internship Report on AIML with Python

Dept of CSE, GEC Haveri 2023-24 2


Internship Report on AIML with Python

Table of Contents

Sl. no Description Page no

1 Overview of the Organization 4

2 About Department 5

3 Introduction 11

4 Task Performed 17

5 Reflection 24

6 Conclusion 32

7 Bibliography 33

Dept of CSE, GEC Haveri 2023-24 3


Internship Report on AIML with Python

CHAPTER-1

Overview of the Organization

Farmercoin Smart Robotic Solution is a company developed from industry research and
academic experienced persons. The company got established in the year 2020 taking
motivation from a 5-year proprietorship from BCSP. The BCSP is a proprietorship MSME
that designs and fabricates PCBs that is located in an industrial area, Hubballi. We are well-
versed in a IOT, Machine\ Deep learning models, Data analysis, networks, databases,
embedded systems, monitoring devices and electric vehicles. We use this expertise to help
customers with small to mid-sized projects.

The company has evolved with multi-disciplined personalities that come from
Biotechnology, Electronics, Computers, Robotics, and Chemistry with a dream of providing
remarkable benefits to society and serving it.

The company focuses on quality, backed by robust tools and methodologies that ensures
the ability to:

1. Meet customer requirements and deliver best services

2. Flexible but robust delivery to customers

3. Enhance end-user satisfaction 4. Increase infrastructure utilization

5. Two fouled infrastructure availability

6. Increase operational efficiency

1.1 Vision and Mission of the organization

Vision: To provide Better monitoring devices for wellbeing for all, now and for future
generations

Mission: To lead research and development of modern days robotics, healthcare and
information technology to provide world-class experience on fingertips to our customers

Dept of CSE, GEC Haveri 2023-24 4


Internship Report on AIML with Python

CHAPTER -2

About Department

2.1 PODUCTS AND MARKET PERFORMANCE

Home and office security systems are an essential investment for anyone who wants to keep
their property and assets safe. These systems typically include a combination of sensors,
cameras, alarms, and control panels that work together to detect and deter intruders. Here are
some key considerations when choosing a home or office security system:

Type of system: There are several types of security systems, including wired, wireless, and
hybrid systems. Wired systems are typically more reliable but can be more difficult to install.

Dept of CSE, GEC Haveri 2023-24 5


Internship Report on AIML with Python

Wireless systems are easier to install but can be less reliable if there are signal issues. Hybrid
systems combine the best of both worlds.

Monitoring: You'll also need to decide whether you want your security system to be
monitored or not. Monitored systems are connected to a monitoring center that will alert the
authorities if an alarm is triggered. Unmonitored systems will only sound an alarm, and it's up
to you or someone else to respond.

Features: Consider what features you need in a security system. For example, some systems
have motion sensors that can detect movement and alert you when someone is in your home
or office. Others have cameras that can capture footage and send it to your phone or
computer.

Cost: Security systems can vary greatly in cost, depending on the type of system, the
features, and whether it's monitored or not. Be sure to consider the upfront costs as well as
any ongoing monitoring fees.

Installation: Some security systems can be installed by the homeowner or office manager,
while others require professional installation. Consider your skills and experience before
deciding which system is right for you.

2.2 NIGHT VISSION ASSISTANCE

Night vision assistance refers to tools or technologies that can help people see in low-light or
dark environments. Here are some common examples:

Infrared cameras: Infrared cameras use heat signatures to create an image, allowing the user
to see in complete darkness.

Flashlights: Flashlights with a high lumen output can provide bright illumination in low-light
environments.

Dept of CSE, GEC Haveri 2023-24 6


Internship Report on AIML with Python

Thermal imaging cameras: These cameras detect heat signatures, allowing the user to see
objects even in complete darkness.

Low-light binoculars: Binoculars with low-light capabilities can provide better visibility in
dark environments.

2.3 SMART ROAD

Smart roads refer to roads and that are


equipped with advanced technologies to improve safety, efficiency, and sustainability. Here
are some examples of smart road technologies:

Intelligent transportation systems (ITS): These systems use connected sensors, cameras,
and data analytics to monitor traffic flow, detect accidents or hazards, and provide real-time
information to drivers. highways

Electric vehicle (EV) charging infrastructure: Smart roads can include charging stations
for electric vehicles, which can help promote the use of EVs and reduce greenhouse gas
emissions.

Smart lighting: LED lighting systems that are connected to a network can be controlled
remotely, adjusting brightness or turning on and off according to traffic flow or weather
conditions.

Solar roads: Solar road technology integrates photovoltaic cells into the road surface,
generating renewable energy to power streetlights or nearby buildings.

Smart pavement: Advanced pavement materials can be used to improve durability and
reduce maintenance costs, while also providing real-time information on traffic flow and
weather conditions.

Dept of CSE, GEC Haveri 2023-24 7


Internship Report on AIML with Python

2.4 AGRI-SUPPLY CHAIN

Blockchain technology is increasingly being explored as a way to improve transparency and


efficiency in agriculture supply chains. Here's how it could work:

Traceability: Blockchain technology can be used to create a transparent and tamper-proof


record of the entire supply chain, from the farm to the final consumer. Each participant in the
chain would have a unique digital identity and their transactions would be recorded on the
blockchain, creating a verifiable and auditable record.

Smart contracts: Smart contracts are self-executing contracts with the terms of the
agreement written into code. They can be used to automate certain processes in the supply
chain, such as payments or quality control checks.

Quality control: Blockchain can be used to ensure that quality control standards are met
throughout the supply chain. For example, sensors or IoT devices can be used to monitor
temperature and humidity levels during transport and storage, with the data being recorded on
the blockchain.

Payments and financing: Blockchain can be used to streamline payments and financing
throughout the supply chain. Smart contracts can be used to automatically release payments
when certain conditions are met, such as the delivery of goods to a certain location.

Sustainability: Blockchain can be used to promote sustainability in the supply chain, by


enabling the tracking of environmental and social impact data. This can help companies make
more informed decisions about their sourcing and production practices.

Dept of CSE, GEC Haveri 2023-24 8


Internship Report on AIML with Python

2.5 AGRICULTURE FIELD MOBILE ROBOT

Mobile robots are increasingly being used in agriculture to improve efficiency and reduce
labor costs. Here are some ways in which mobile robots can be used in the agriculture field:

Crop monitoring: Mobile robots equipped with sensors and cameras can be used to monitor
crops, collecting data on growth, soil moisture, and other factors. This information can help
farmers make more informed decisions about irrigation, fertilization, and pest control.

Crop spraying: Robots can be used to spray crops with pesticides or fertilizers, reducing the
need for human labor and improving precision.

Harvesting: Mobile robots can be used to harvest crops such as fruits, vegetables, and nuts,
which can be time-consuming and labor-intensive for human workers.

Weeding: Robots can be used to identify and remove weeds from crop fields, reducing the
need for herbicides and manual labor.

Soil analysis: Mobile robots can be used to collect soil samples and analyze them for nutrient
levels, pH, and other factors. This information can be used to optimize fertilization and crop
yields.

Dept of CSE, GEC Haveri 2023-24 9


Internship Report on AIML with Python

2.6 PLANT HEALTH MONITORING

Vision-based cotton plant health monitoring is a technique that uses computer vision and
machine learning to analyze images of cotton plants and identify any signs of stress, disease,
or damage. Here's how it works:

Data collection: High-resolution images of cotton plants are collected using cameras
mounted on drones or ground-based vehicles. These images capture the visible and near-
infrared spectra, which can provide valuable information about the health and vitality of the
plants.

Image processing: The images are processed using computer vision algorithms to extract
features such as leaf area, chlorophyll content, and leaf angle. These features are then used to
calculate indices such as the normalized difference vegetation index (NDVI) or the green
normalized difference vegetation index (GNDVI).

Machine learning: Machine learning algorithms are used to analyze the indices and detect
any signs of stress or disease in the plants. The algorithms can be trained on a dataset of
healthy and stressed plants, allowing them to accurately identify the presence and severity of
any issues.

Actionable insights: The output of the analysis can provide farmers with actionable insights,
such as the need for targeted irrigation, fertilization, or pest control measures. This can help
farmers optimize their crop yields while reducing costs and environmental impact

Dept of CSE, GEC Haveri 2023-24 10


Internship Report on AIML with Python

CHAPTER-3

INTRODUCTION
Introduction Artificial Intelligence (AI) and Machine Learning (ML) stand at the forefront of
technological innovation, driving advancements across a vast array of sectors. AI refers to the
simulation of human intelligence in machines that are programmed to think and learn like
humans. The scope of AI encompasses various technologies, including machine learning,
natural language processing, robotics, and computer vision. Machine Learning, a subset of
AI, focuses on the development of algorithms that can learn from and make predictions or
decisions based on data. ML enables computers to access hidden insights without being
explicitly programmed where to look.

In recent years, AI and ML have evolved from theoretical concepts to practical tools that
solve complex problems and enhance efficiency in industries such as healthcare, finance,
agriculture, and automotive, among others. The ability of AI and ML technologies to analyze
large volumes of data and automate tasks has revolutionized the way organizations operate,
leading to improved outcomes and innovative solutions.

3.1 The Significance of AI and ML in the Current Technological Landscape

The significance of AI and ML in today's technological landscape cannot be overstated.


These technologies are critical drivers of digital transformation, enabling businesses and
societies to make data-driven decisions, optimize processes, and create new products and
services. In healthcare, AI-powered tools are improving patient outcomes through
personalized medicine and early detection of diseases. In agriculture, ML algorithms are
being used to predict crop yields, optimize planting strategies, and reduce environmental
impact. Furthermore, AI and ML are integral to the development of autonomous vehicles,
smart cities, and intelligent systems that promise to redefine our daily lives.

The ability of AI and ML to process and analyze data at an unprecedented scale also plays a
pivotal role in addressing global challenges, such as climate change, by providing insights
that can lead to sustainable solutions. Moreover, these technologies are fostering innovation
in the field of natural language processing, making human-computer interactions more
intuitive and enhancing accessibility to digital technologies.

Dept of CSE, GEC Haveri 2023-24 11


Internship Report on AIML with Python

3.2 Objectives and Goals of the Internship

The primary objective of the one-month internship at FarmerCoin for students in their 4th
semester is to equip them with practical knowledge and hands-on experience in AI and ML.
By integrating academic learning with real-world applications, the internship aims to:

1. Enhance Technical Skills: Provide in-depth training on AI and ML concepts, including


supervised, unsupervised, and reinforcement learning algorithms. This includes
understanding the theoretical foundations as well as applying these concepts to solve practical
problems.

2. Problem-Solving Experience: Engage students in projects that require them to apply their
AI and ML knowledge to address real-world challenges, particularly in the context of
FarmerCoin's focus areas. This will help students develop critical thinking and problem-
solving skills.

3. Professional Development: Offer students the opportunity to work alongside experienced


professionals in the field of AI and ML, allowing them to gain insights into the industry and
understand the practical applications of their academic knowledge.

4. Innovation and Creativity: Encourage students to explore innovative solutions and


creative approaches to using AI and ML in various domains, fostering a culture of innovation
and continuous learning.

5. Preparation for Future Careers: Prepare students for future roles in the rapidly evolving
field of AI and ML, equipping them with the skills and experience necessary to contribute to
the advancement of technology and society.

Through this internship, students are expected to gain a comprehensive understanding of AI


and ML technologies, apply their knowledge to real-world problems, and develop the skills
necessary to succeed in their future careers.

3.3 Background and Literature Review

The field of Artificial Intelligence (AI) and Machine Learning (ML) encompasses a broad
range of technologies, concepts, and methodologies that have seen significant advancements
in recent years. This section provides an overview of the key concepts, technologies, and
frameworks relevant to the projects undertaken during the internship at FarmerCoin, along
with a summary of recent advancements and a review of pertinent literature.

Dept of CSE, GEC Haveri 2023-24 12


Internship Report on AIML with Python

Key Concepts, Technologies, and Frameworks

• Supervised Learning: A machine learning technique where models are trained on labeled
data, learning to predict outcomes for new, unseen data based on that training. Key
algorithms include linear regression for continuous outcomes and logistic regression, decision
trees, and neural networks for categorical outcomes.

• Unsupervised Learning: This technique involves training models on data without labeled
responses, enabling the discovery of patterns or structures within the data. Common methods
include clustering (e.g., k-means, hierarchical clustering) and dimensionality reduction
techniques (e.g., Principal Component Analysis - PCA).

• Reinforcement Learning: A type of machine learning where an agent learns to make


decisions by performing actions in an environment to achieve some goals, receiving rewards
or penalties for the actions taken. It's widely used in robotics, gaming, and navigation tasks.

• Neural Networks and Deep Learning: At the core of many recent AI advancements,
neural networks, particularly deep learning models, are capable of learning complex patterns
in large datasets. Frameworks like TensorFlow and PyTorch have become standard tools for
developing these models.

3.4 Recent Advancements

Recent advancements in AI and ML have focused on improving model efficiency, accuracy,


and the ability to generalize across tasks. Notably, the development of transformers (e.g.,
BERT, GPT-series) has revolutionized natural language processing, enabling more
sophisticated understanding and generation of human language. In reinforcement learning,
techniques such as Deep Q-Networks (DQN) and Proximal Policy Optimization (PPO) have
pushed the boundaries of what is possible in game playing and robotics. Additionally,
advancements in federated learning present new paradigms for training ML models on
decentralized data, respecting privacy and reducing data centralization issues.

Machine learning is one of the applications of python

 Python is widely used general purpose,high level programming language. It was


initially designed by Guido van Rossum in 1991and developed by Python Software
Foundation.It was mainly developed for emphasis on code readability, and its syntax
allows programmers to express concepts in fewer lines of code.

Dept of CSE, GEC Haveri 2023-24 13


Internship Report on AIML with Python

 Python is a programming language that lets you work quickly and integrate systems
more efficiently. Python was designed for readability, and has some similarities to the
English language with influence from mathematics. Python uses new lines to
complete a command as opposed to other programming language which often use
semicolons or parentheses.

The most recent major version of Python is Python 3, which we shall be using in this tutorial.
Python can be used on a server to create web applications. It can be used along side software
to create workflows. It can connect to database system and also read and modify files.

Python can be used to handle big data and perform complex mathematics. It can be used for
rapid prototyping, or for production ready software development. It works on different
platforms (Windows, Mac, Linux, Raspberry Pi, etc). It runs on an interpreter system,
meaning that code can be executed as soon as it is written. This means that prototyping can
be very quick.

3.5 Applications of Python

1. Web development : Web framework like Django and Flask are based on Python. They
help you write server side code which helps you manage database, write backend
programming logic, mapping urls etc.

2. Machine learning : There are many machine learning applications written in Python.
Machine learning is a way to write a logic so that a machine can learn and solve a particular
problem on its own. For example, products recommendation in websites like Amazon,
Flipkart, eBay etc. is a machine learning algorithm that recognises user’s interest. Face
recognition and Voice recognition in your phone is another example of machine learning.

3. Data Analysis : Data analysis and data visualisation in form of charts can also be
developed using Python.

4. Scripting : Scripting is writing small programs to automate simple tasks such as sending
automated response emails etc. Such type of applications can also be written in Python
programming language.

5. Game development : You can develop games using Python.

6. You can develop Embedded applications in Python.

Dept of CSE, GEC Haveri 2023-24 14


Internship Report on AIML with Python

7. Desktop applications :You can develop desktop application in Python using library like
TKinter or QT.

Literature and Studies Review : The literature relevant to the projects undertaken during the
internship encompasses a wide array of studies and papers. Key references might include:

• "Deep Learning" by Ian Goodfellow, Yoshua Bengio, and Aaron Courville: This co

mprehensive text provides foundational knowledge on deep learning techniques, including


detailed explanations of neural networks and their applications.

• "Reinforcement Learning An Introduction" by Richard S. Sutton and Andrew G. Barto:


A seminal work in the field of reinforcement learning, offering both theoretical frameworks
and practical examples.

• "Research papers on specific applications of AI and ML in agriculture": For instance,


studies on precision agriculture using ML for crop and soil management, pest detection, and
yield prediction. These papers illustrate the practical application of AI/ML technologies in
real-world scenarios similar to those explored during the internship.

• "Case studies on the use of unsupervised learning in data analysis" Such studies
demonstrate the power of unsupervised learning techniques in uncovering hidden patterns in
data without the need for labeled datasets. This literature and the ongoing research in the field
have informed the projects undertaken during the internship, providing both theoretical
underpinnings and practical examples of AI and ML applications. The internship projects
aimed to apply these concepts and technologies to address specific challenges, leveraging the
latest advancements in the field to develop innovative solutions

3.6 Skills gained on AI ML

Following are the algorithm on which we have gained the knowledge:

Supervised Learning Algorithms

1. Linear Regression: A regression algorithm that models the relationship between a


dependent variable and one or more independent variables by fitting a linear equation
to observed data.
2. Logistic Regression: A classification algorithm used to predict the probability of a
target variable belonging to one of the classes, particularly useful for binary
classification problems.
Dept of CSE, GEC Haveri 2023-24 15
Internship Report on AIML with Python

3. Decision Trees: A model that uses a tree-like graph of decisions and their possible
consequences, including chance event outcomes, resource costs, and utility. It's used for both
regression and classification tasks.

4. Support Vector Machines (SVM): A powerful classification technique that finds the
hyperplane that best separates data into two classes in a high-dimensional space.

5. Random Forests: An ensemble learning method for classification and regression that
operates by constructing a multitude of decision trees at training time and outputting the class
that is the mode of the classes (classification) or mean prediction (regression) of the
individual trees.

6. Gradient Boosting Machines (GBM): An ensemble technique that builds models in a


stage-wise fashion like other boosting methods but generalizes them by allowing
optimization of an arbitrary differentiable loss function.

3.7 Unsupervised Learning Algorithms

1. K-Means Clustering: A method of vector quantization, originally from signal processing,


that aims to partition �n observations into �k clusters in which each observation belongs to
the cluster with the nearest mean.

2. Principal Component Analysis (PCA): A statistical procedure that uses an orthogonal


transformation to convert a set of observations of possibly correlated variables into a set of
values of linearly uncorrelated variables called principal components.

3. Hierarchical Clustering: A method of cluster analysis which seeks to build a hierarchy of


clusters. Strategies for hierarchical clustering generally fall into two types: agglomerative
(bottom-up) and divisive (top-down).

3.8 Reinforcement Learning Techniques

1. Q-Learning: It's considered one of the simplest forms of reinforcement learning and is
used to inform decisions by estimating the utility of action-state pairs.

2.Deep Q-Network (DQN): It combines Q-learning with deep neural networks at scale,
enabling the learning of successful policies directly from high-dimensional sensory inputs
through end-to-end reinforcement learning.

Dept of CSE, GEC Haveri 2023-24 16


Internship Report on AIML with Python

CHAPTER-4

Task Performed
4.1 Assignments

T1

Dept of CSE, GEC Haveri 2023-24 17


Internship Report on AIML with Python

Dept of CSE, GEC Haveri 2023-24 18


Internship Report on AIML with Python

Dept of CSE, GEC Haveri 2023-24 19


Internship Report on AIML with Python

Dept of CSE, GEC Haveri 2023-24 20


Internship Report on AIML with Python

Dept of CSE, GEC Haveri 2023-24 21


Internship Report on AIML with Python

Dept of CSE, GEC Haveri 2023-24 22


Internship Report on AIML with Python

Dept of CSE, GEC Haveri 2023-24 23


Internship Report on AIML with Python

CHAPTER-5

Reflection
import pandas as pd
import numpy as np
from sklearn.cluster import KMeans
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
# Load customers data
customersdata = pd.read_csv("D:\\ML_project\\customers-data - customers-
data.csv")
# Select relevant columns for clustering
data = customersdata[['products_purchased', 'complains', 'money_spent']]
# Determine the optimal number of clusters using the elbow method
inertias = []
for k in range(1, 11):
kmeans = KMeans(n_clusters=k, init='k-means++', max_iter=400,
random_state=42, n_init=10) # Explicitly set n_init
kmeans.fit(data)
inertias.append(kmeans.inertia_)
# Plot the elbow method graph to find the optimal number of clusters
plt.figure(figsize=(8, 6))
plt.plot(range(1, 11), inertias, marker='o', linestyle='--')
plt.title('Elbow Method for Optimal Number of Clusters')
plt.xlabel('Number of Clusters')
plt.ylabel('Inertia')
plt.grid()
plt.show()

# Based on the elbow method, let's choose K=3 as the optimal number of
clusters
optimal_k = 3

# Apply K-Means clustering with the optimal K


kmeans = KMeans(n_clusters=optimal_k, init='k-means++', max_iter=400,
random_state=42, n_init=10) # Explicitly set n_init
clusters = kmeans.fit_predict(data)

# Add cluster labels to the original DataFrame


customersdata['cluster'] = clusters

# Create 3D scatter plot for visualization


fig = plt.figure(figsize=(10, 8))
ax = fig.add_subplot(111, projection='3d')

x = customersdata['products_purchased']
y = customersdata['complains']
z = customersdata['money_spent']
c = clusters

ax.scatter(x, y, z, c=c, cmap='viridis', s=50)


ax.set_xlabel('Products Purchased')
ax.set_ylabel('Complains')
ax.set_zlabel('Money Spent')
ax.set_title('3D Scatter Plot of Clusters')

plt.show()

Dept of CSE, GEC Haveri 2023-24 24


Internship Report on AIML with Python

import joblib
import pandas as pd

# Load the saved linear regression model


model_filename = "D:\\ML_project\\HeiWei_linear_Reg_model.pkl"
loaded_model = joblib.load(model_filename)

# Input the features for prediction


# For example, let's predict the weight based on height (inches) and gender
(0 for Male, 1 for Female)
height = height # Replace with the height you want to predict
gender = gender # Replace with the gender (0 for Male, 1 for Female)

# Create a DataFrame with feature names


input_data = pd.DataFrame({'Height': [height], 'Gender': [gender]})

# Use the loaded model to make predictions


predicted_weight = loaded_model.predict(input_data)

print(f"Predicted Weight: {predicted_weight[0]:.2f} pounds")

import sys
import os
from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton,
QVBoxLayout, QWidget, QLabel, QLineEdit, QMessageBox, QTextEdit,
QHBoxLayout
import subprocess
class VirtualEnvActivatorApp(QMainWindow):
def __init__(self):
super().__init__()
self.initUI()

def initUI(self):
self.setWindowTitle("ML App")
self.setGeometry(100, 100, 400, 200)

self.activate_button = QPushButton("Show Models", self)


self.activate_button.setGeometry(100, 20, 200, 40)

self.activate_button.clicked.connect(self.activate_and_open_new_window)

def activate_virtualenv(self):
# Replace 'your_virtualenv_path' with the actual path to your
virtual environment
virtualenv_path = "D:\\myenv"
activate_script = os.path.join(virtualenv_path, 'Scripts',
'activate')

if os.path.exists(activate_script):
try:
# Use a subprocess to activate the virtual environment
#subprocess.Popen(f'cmd.exe /K {activate_script}',
shell=True)
pass
except Exception as e:
QMessageBox.warning(self, "Activation", f"Error activating
virtual environment: {e}")

Dept of CSE, GEC Haveri 2023-24 25


Internship Report on AIML with Python

else:
QMessageBox.warning(self, "Activation", f"Virtual environment
'{virtualenv_path}' not found.")

def activate_and_open_new_window(self):
self.activate_virtualenv()
self.open_new_window()

def open_new_window(self):
self.new_window = NewWindow()
self.new_window.show()

class OutputWindow(QWidget):
def __init__(self, output_text):
super().__init__()
self.setWindowTitle("Output Window")
self.setGeometry(500, 400, 1000, 600)

layout = QVBoxLayout()

self.output_textedit = QTextEdit(self)
self.output_textedit.setPlainText(output_text)
self.output_textedit.setReadOnly(True)
layout.addWidget(self.output_textedit)

self.setLayout(layout)

class NewWindow1(QWidget):
def __init__(self):
super().__init__()
self.setWindowTitle("Weight Estimator")
self.setGeometry(600, 400, 800, 400)

layout = QVBoxLayout()

# Gender Input
gender_layout = QHBoxLayout()
gender_label = QLabel("Gender:")
self.gender_input = QLineEdit()
gender_layout.addWidget(gender_label)
gender_layout.addWidget(self.gender_input)
layout.addLayout(gender_layout)

# Height Input
height_layout = QHBoxLayout()
height_label = QLabel("Height:")
self.height_input = QLineEdit()
height_layout.addWidget(height_label)
height_layout.addWidget(self.height_input)
layout.addLayout(height_layout)

# Run Button
self.run_button = QPushButton("Run", self)
self.run_button.clicked.connect(self.run_script)
layout.addWidget(self.run_button)

self.setLayout(layout)

def run_script(self):
file_path = "D:\\ML_project\\HeiWei_Linear_Reg.py"

Dept of CSE, GEC Haveri 2023-24 26


Internship Report on AIML with Python

try:
with open(file_path, 'r') as file:
code = file.read()

self.python_code = code
if hasattr(self, 'python_code'):
gender = self.gender_input.text()
height = self.height_input.text()

if gender and height:


try:
exec_globals = {
'gender': gender,
'height': height
}
captured_output =
self.capture_output(self.python_code, exec_globals)
self.open_output_window(captured_output)

except Exception as e:
self.show_error_dialog(str(e))
else:
self.show_error_dialog("Please enter values for both
gender and height.")
else:
self.show_error_dialog("Please select a Python file ")
except FileNotFoundError:
self.show_error_dialog(f"File not found: {file_path}")

# Implement capture_output and open_output_window functions as needed

# Add the show_error_dialog function here


def show_error_dialog(self, message):
QMessageBox.warning(self, "Error", message)
def capture_output(self, code, globals_dict):
import sys
from io import StringIO

original_stdout = sys.stdout
sys.stdout = StringIO()

try:
exec(code, globals_dict)
except Exception as e:
return str(e)
finally:
captured_output = sys.stdout.getvalue()
sys.stdout = original_stdout

return captured_output

def show_error_dialog(self, error_message):


QMessageBox.critical(self, "Error", error_message)

def open_output_window(self, output_text):


self.output_window = OutputWindow(output_text)
self.output_window.show()

class NewWindow2(QWidget):

Dept of CSE, GEC Haveri 2023-24 27


Internship Report on AIML with Python

def __init__(self, script_path):


super().__init__()
self.setWindowTitle("Customer Data Analysis")
self.setGeometry(600, 400, 800, 400)

self.script_path = script_path

layout = QVBoxLayout()

# Run Button for Python Script


self.run_script_button = QPushButton("Run", self)
self.run_script_button.clicked.connect(self.run_python_script)
layout.addWidget(self.run_script_button)

self.setLayout(layout)

def run_python_script(self):
if self.script_path:
try:
with open(self.script_path, 'r') as file:
code = file.read()

exec_globals = {}
captured_output = self.capture_output(code, exec_globals)
#self.open_output_window(captured_output)

except Exception as e:
self.show_error_dialog(str(e))
else:
self.show_error_dialog("Please specify the path to the Python
script to run.")

# Implement capture_output and open_output_window functions as needed

# Add the show_error_dialog function here


def show_error_dialog(self, message):
QMessageBox.warning(self, "Error", message)
def capture_output(self, code, globals_dict):
import sys
from io import StringIO

original_stdout = sys.stdout
sys.stdout = StringIO()

try:
exec(code, globals_dict)
except Exception as e:
return str(e)
finally:
captured_output = sys.stdout.getvalue()
sys.stdout = original_stdout

return captured_output

def show_error_dialog(self, error_message):


QMessageBox.critical(self, "Error", error_message)

def open_output_window(self, output_text):


self.output_window = OutputWindow(output_text)
self.output_window.show()

Dept of CSE, GEC Haveri 2023-24 28


Internship Report on AIML with Python

class NewWindow(QWidget):
def __init__(self):
super().__init__()
self.initUI()

def initUI(self):
layout = QVBoxLayout()

# Add a button to open NewWindow1


self.action_button1 = QPushButton("Weight Estimator", self)
self.action_button1.clicked.connect(self.open_window1)
layout.addWidget(self.action_button1)

# Add a button to open NewWindow2 with a specified Python script


path
self.action_button2 = QPushButton("Customer Data Analysis", self)
self.action_button2.clicked.connect(self.open_window2)
layout.addWidget(self.action_button2)

self.setLayout(layout)

def open_window1(self):
self.window1 = NewWindow1()
self.window1.show()

def open_window2(self):
# Specify the path to the Python script you want to run
script_path = "D:\\ML_project\\k-Means_Customer_Analysis.py" #
Replace with the actual path
self.window2 = NewWindow2(script_path)
self.window2.show()

def main():
app = QApplication(sys.argv)
window = VirtualEnvActivatorApp()
window.show()
sys.exit(app.exec_())

if __name__ == '__main__':
main()

Dept of CSE, GEC Haveri 2023-24 29


Internship Report on AIML with Python

Dept of CSE, GEC Haveri 2023-24 30


Internship Report on AIML with Python

Dept of CSE, GEC Haveri 2023-24 31


Internship Report on AIML with Python

CONCLUSION:
The project involved analysis of height-weight of the particular customers and customer data
analysis with proper data processing. By using this we get the following outputs:

 Predicted weight
 Product purchased
 Complains
 Money spent
 Optimal number of clusters

This internship has been an excellent and rewarding experience. I can conclude that there
have been a lot I`ve learnt from my work at internship. Needless to say, the technical aspects
of the work I`ve done are not flawless and could be improved provided enough time. As
someone with no prior experience with AI and ML. Whatsoever I believe my time spent in
research and discovering it was well worth it and contributed to finding an acceptable
solution to build a fully functional real time application. The things that I`ve learned the
importance of our time-0management skills, self-motivation and ability to learn new things.

Dept of CSE, GEC Haveri 2023-24 32


Internship Report on AIML with Python

BIBILOGRAPHY:
Website:

1.https://www,datacamp.com/corses/intro-topython-for-data-science

2.https://developers.google.com/edu/python

3.www.books.google.co.in

4.www.aimlworld.com

5.www.w3school.com

Reference Book:

1.“Artificial intelligence for Dummies(second addition)”

2.Artificial intelligence with python

3.introduction to machine learning with python

4.program collective intelligence of machine learning

Dept of CSE, GEC Haveri 2023-24 33

You might also like