this is the nav!
Competition - Abalone Seafood Farming
• AI Chat
• Code
• Report
• ## .mfe-app-workspace-kj242g{position:absolute;top:-8px;}.mfe-app-workspace-11ezf91{display:inline-block;}.mfe-app-workspace-11ezf91:hover .Anchor__copyLink{visibility:visible;}Can you estimate the age of an abalone?

### ๐ฉ๐ผโ๐ผ Introduction

-- Backgrounds You are working as an intern for an abalone farming operation in Japan. For operational and environmental reasons, it is an important consideration to estimate the age of the abalones when they go to market.

Determining an abalone's age involves counting the number of rings in a cross-section of the shell through a microscope. Since this method is somewhat cumbersome and complex, you are interested in helping the farmers estimate the age of the abalone using its physical characteristics.

.mfe-app-workspace-11z5vno{font-family:JetBrainsMonoNL,Menlo,Monaco,'Courier New',monospace;font-size:13px;line-height:20px;}pip install category_encoders 
pip install colored
import pandas as pd
import numpy as np

from termcolor import colored
from colored import fore, back, style

import seaborn as sns
import matplotlib.pyplot as plt

import scipy as sp
from scipy import stats

from sklearn.model_selection import train_test_split
from sklearn.model_selection import GridSearchCV
from sklearn.compose import TransformedTargetRegressor

from sklearn.compose import make_column_selector
from sklearn.compose import make_column_transformer

from sklearn.pipeline import make_pipeline,Pipeline

from sklearn.preprocessing import PowerTransformer
from sklearn.preprocessing import OneHotEncoder

import category_encoders as ce

import xgboost as xgb
from sklearn.linear_model import LinearRegression,Lasso,Ridge

from sklearn.metrics import mean_squared_error, r2_score

abalone = pd.read_csv('./data/abalone.csv')


Abalone characteristics:

• "sex" - M, F, and I (infant).
• "length" - longest shell measurement.
• "diameter" - perpendicular to the length.
• "height" - measured with meat in the shell.
• "whole_wt" - whole abalone weight.
• "shucked_wt" - the weight of abalone meat.
• "viscera_wt" - gut-weight.
• "shell_wt" - the weight of the dried shell.
• "rings" - number of rings in a shell cross-section.
• "age" - the age of the abalone: the number of rings + 1.5.

Acknowledgments: Warwick J Nash, Tracy L Sellers, Simon R Talbot, Andrew J Cawthorn, and Wes B Ford (1994) "The Population Biology of Abalone (Haliotis species) in Tasmania. I. Blacklip Abalone (H. rubra) from the North Coast and Islands of Bass Strait", Sea Fisheries Division, Technical Report No. 48 (ISSN 1034-3288).

# Check missing value

abalone.isna().sum()

๐ฉ๐ผโ๐ซ Constat:

โ Abalone dataset does not have missing value.

### ๐๐ผโโ๏ธ Let's go to the analysis

#### Part A : How does weight change with age for each of the three sex categories?

๐ Description

๐ There are 3 sex categories that we have to consider with different weights:

โ Sexes : Male,female and infant

โ Weights: Whole,shucked,viscera and shell.

๐ What are we trying to find?

โ How does weight change with age for each of the three sex categories?

๐ What will be the stages?

โ A graphique visualization : Scatterplot

โ A statistic test to refute or confirm the hypothesis.

print(colored('                           ๐งฎScatterPlot :  Weight by age and sex category','grey',attrs=['bold']))
for column_ in abalone.columns[4:8]:
g = sns.FacetGrid(abalone, col="sex")
g.map(sns.scatterplot,'age', column_)
plt.show()

๐ฉ๐ผโ๐ซ Constat:

โ The weight of abalone seems to increase positively with age and that whatever the sex category.

๐ How could this be proven?

โ The solution is to use a correlation test.

โ The most well-known is the Pearson correlation test,but the calculation of the p-value relies on the assumption that variable is normally distributed.

๐๐ผFirst stage:

โ Determine if each variable is normally distributed

โ We can use the shapiro test that can be use until n is inferior at 5000.

๐๐ผSecond stage:

โ Use a corralation test.

โ The test used depends on the result of shapiro test:

โข If the variable have a normal distribution we use : Pearson test

โข If If the variable have not a normal distribution we use : Kendaull test

โ
โ
โ