Giter Site home page Giter Site logo

hugo-hattori / watercraft_values_ai_prediction Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 245 KB

Data Science Project.

License: MIT License

Jupyter Notebook 98.52% Python 1.48%
data-analysis data-analytics data-science jupyter jupyter-notebook matplotlib matplotlib-pyplot pandas pandas-dataframe pandas-python

watercraft_values_ai_prediction's Introduction

Watercraft Values AI Prediction

This project's goal is to create an AI Model capable of predicting watercraft prices based on their composition material, width, length, watercraft type (e.g. yatch, fishing boat), sell type (e.g. new boat, used boat), and manufacture year using a database for the model training.

Packages used:

  • sklearn
  • pandas
  • seaborn
  • matplotlib

Importing the Database

First we need to import the database, which in this scenario is a .csv file named "barcos_ref.csv". By using the DataFrame.info() method we can observe that no data processing will be necessary in this case.

#Extração/Obtenção de Dados
tabela = pd.read_csv("barcos_ref.csv")
display(tabela)
#Tratamento de Dados
print(tabela.info())

Exploratory Data Analysis (EDA)

Now we will analyze the correlation between the price and the other parameters such as length and composition material.

#Análise Exploratória
correlacao = tabela.corr()[["Preco"]]
display(correlacao)
sns.heatmap(correlacao, annot=True, cmap="Greens")
plt.show()

img.png

AI Modeling

In this scenario we will be using Linear Regression and Random Forest Regressor as Machine Learning Algorithms, thus two models will be generated.

For the AI training process it is necessary to split the database into x_treino, x_teste, y_treino, y_teste where "x" are the parameters used to achieve the "y" which is the price. Both x_treino and y_treino are going to be used for the AI training afterwards x_teste and y_teste will both be used to test the AI Model's accuracy based on the R² Score.

#Modelagem
y = tabela["Preco"]
x = tabela.drop("Preco", axis=1)
x_treino, x_teste, y_treino, y_teste = train_test_split(x,y, test_size=0.3, random_state = 1)
#Treinamento da Inteligência Artificial
modelo_regressaoLinear = LinearRegression()
modelo_arvoreDecisao = RandomForestRegressor()
modelo_regressaoLinear.fit(x_treino, y_treino)
modelo_arvoreDecisao.fit(x_treino, y_treino)
#Interpretação de Resultados
previsao_regressaoLinear = modelo_regressaoLinear.predict(x_teste)
previsao_arvoreDecisao = modelo_arvoreDecisao.predict(x_teste)
print(r2_score(y_teste, previsao_regressaoLinear))
print(r2_score(y_teste, previsao_arvoreDecisao))

Graphical Analysis

To make it more evident we will plot graphs that compare both the Linear Regression and Random Forest Regressor models to "y_teste".

  • Linear Regression X y_teste

img_1.png

  • Random Forest Regressor X y_teste

img_2.png

AI Prediction

The model with the highest score is the chosen one to predict watercraft prices using a different database called "novos_barcos.csv"

#Utilizando a IA treinada com novos dados
tabela_nova = pd.read_csv("novos_barcos.csv")
display(tabela_nova)
nova_previsao = modelo_arvoreDecisao.predict(tabela_nova)
print(nova_previsao)

The "nova_previsao" variable contains the respective price values predicted by the AI Model.

Note: this is a project developed for academic purposes, therefore the data contained in "barcos_ref.csv" and "novos_barcos.csv" are fictitious and used only to learn AI model training applications.

watercraft_values_ai_prediction's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.