<jupyter_start><jupyter_text>Observation It is evnident that the data set doenst have the column labels hence the first observation has been taken as the column names.As per the above the data set has a total of 305 rows and 4 columns but since the first observation has been taken as a thetile of the columnns, the dataset actually has 306 rows and 4 columnsNext StepsFind out what are the column names and what they actually represent and give column labels accordingly. Next Steps: Step 1I was able to find out from the description of the dataset that the attribute information is as below:Attribute Information:Age of patient at time of operation (numerical)Patient's year of operation (year - 1900, numerical)Number of positive axillary nodes detected (numerical)Survival status (class attribute)1 = the patient survived 5 years or longer2 = the patient died within 5 year<jupyter_code>#Giving each of the attributes its appropriate Title
attr_labels=["age","Year of Operation","# Positive axillary nodes detected",'survival status']
df.columns=attr_labels 
df.head()
#check for Null values in a DataFrame
df.isnull().sum()<jupyter_output><empty_output><jupyter_text>It is evident from above that there are no missing values in the dataframe<jupyter_code>#Getting the DateTypes of all the attributes in the dataframe
df.info()<jupyter_output><class 'pandas.core.frame.DataFrame'>
RangeIndex: 306 entries, 0 to 305
Data columns (total 4 columns):
 #   Column                              Non-Null Count  Dtype
---  ------                              --------------  -----
 0   age                                 306 non-null    int64
 1   Year of Operation                   306 non-null    int64
 2   # Positive axillary nodes detected  306 non-null    int64
 3   survival status                     306 non-null    int64
dtypes: int64(4)
memory usage: 9.7 KB<jupyter_text>Observation: All the 4 columns appear to be of the int Data Type and the datatype of each of the attributes matches with the description of the dataset Since the Year of Operation attribute is in the 20th century but the Year of operation attribute only has the last 2 digits ofthe attribute hence adding 1900 to each of the row items to display the year as 19XX<jupyter_code>df['Year of Operation']= df['Year of Operation']+1900
df.head()
#Check the distribution of Survival Status of the pateients between the two classes
count_1= 0
count_2= 0
for i in df['survival status']:
    if i == 1:
        count_1= count_1+1
    else:
        count_2= count_2+1
        
print("The Number of patients who survived 5 years or longer are: {}".format(count_1))
print("The Number of patients who died wihtin 5 years are: {}".format(count_2))
print("The percentage of the patients who survived 5 years or longer are",count_1/(count_1+count_2))
print("The percentage of the patients who died wihtin 5 years are",count_2/(count_1+count_2))<jupyter_output>The Number of patients who survived 5 years or longer are: 225
The Number of patients who died wihtin 5 years are: 81
The percentage of the patients who survived 5 years or longer are 0.7352941176470589
The percentage of the patients who died wihtin 5 years are 0.2647058823529412<jupyter_text>Observations: From the above analysis it is evident that 73.5% of the patients have survived the treatment while 26.4% of thepatients have died wihtin 5 years.<jupyter_code>#Plot a bar chart to look at the distribution of the survival status

#Setting up the dimensions of the background plane or the layout with width 10 and height 5
fig= plt.figure(figsize=(10,5))

#Plotting the bar chart
status= ["Survived >5 Years","Falied to Survive"]
counts= [count_1, count_2]

plt.bar(status,counts, color="blue", width=0.4)

plt.xlabel("Survival Status")
plt.ylabel("Count of each Class")
plt.title("Distribution of the Survival Status attribute")
plt.show()

#Checking if the attribute Number of Positive axillary nodes detected attribute has classes or just integeres
u= df['# Positive axillary nodes detected'].unique()
print("The number of unique elements in the atrribute are: ", len(u))
print("The Unique elements in the attribute are: ", u)<jupyter_output>The number of unique elements in the atrribute are:  31
The Unique elements in the attribute are:  [ 1  3  0  2  4 10  9 30  7 13  6 15 21 11  5 23  8 20 52 14 19 16 12 24
 46 18 22 35 17 25 28]<jupyter_text>Observation: Since there are 31 unique elements in the column " Positive axillary nodes detected", it is not advisable toconsider the attribute as a class variable<jupyter_code>#Looking at the age distribution of the patients
print("The Minimum age of the patinets in the study is: ", df["age"].min())
print("The Maximum age of the patients in the stuy is: ", df["age"].max())
print("The mean age of the patients in the study is: ", df["age"].mean())
print("The median age of the patients in the study is: ", df["age"].median())
print("The standard deviation of the age of the patients in the studyt is: ", df["age"].std())<jupyter_output>The Minimum age of the patinets in the study is:  30
The Maximum age of the patients in the stuy is:  83
The mean age of the patients in the study is:  52.45751633986928
The median age of the patients in the study is:  52.0
The standard deviation of the age of the patients in the studyt is:  10.80345234930328<jupyter_text>Observation:The data shows that the study has covered adult population with age spanning from 3 years to 83 years and theaverage age of the patient at close to 52 years. It looks like the study has focused a little more on the ageing population.Since cancer is predominantly common in the senior population the study has focused on the sameFrom the cursory look at the mean and the median values, it seems like the age attribute is normally disctributed<jupyter_code>#plotting to see if the Age attribute is well distributed
sns.FacetGrid(df, height=5).map(sns.distplot,"age")
plt.show()
#Looking at the number of years and the years the data was collected
years= df['Year of Operation'].unique()
years.sort()
print("The Number of Years the data was collected: ", len(years))
print("The Years during which the study was carried out ", years)
#Get the number of row itesm for each of the years
y= list(df['Year of Operation'].value_counts())
y
#Plotting to see the distribution of the samples year wise

#Setting up the backgroud plane
fig= plt.figure(figsize= (12,6))

#Plotting the Histrograms
plt.bar(years,y,color= 'red',width=0.4)
plt.xlabel("Year of Operation")
plt.ylabel("Counts")
plt.title("Year Wise Count of the Patients")
plt.show()<jupyter_output><empty_output><jupyter_text>Observation: The patient count has been coming down from the start to the end of the study, the patient count started at 36 andhas gradually come down to 13 by the end of the study. No Specific reason has been mentioned in the description for the fall in the patient count.<jupyter_code>#Checking for the number of positive axillary nodes detected values
a= list(df["# Positive axillary nodes detected"].unique())
print(a)
len(a)<jupyter_output>[1, 3, 0, 2, 4, 10, 9, 30, 7, 13, 6, 15, 21, 11, 5, 23, 8, 20, 52, 14, 19, 16, 12, 24, 46, 18, 22, 35, 17, 25, 28]<jupyter_text>Objecttive: To find out the most influenctial attribute on the Survival Staus  Univariate Analysis<jupyter_code>#Changing the survival status variable from classes 1 and 2 to "Alive" and "Dead"
for i in df["survival status"]:
    if i==1:
        
#Chcking the distribution of the Age attribute on the survival status
sns.FacetGrid(df,hue= "survival status", height=5).map(sns.distplot,'age').add_legend()
plt.show()<jupyter_output><empty_output><jupyter_text>Observation:There is almost a complete overlap of the two clasess of Survival Status hence age alone cannot be used todifferentiate between the 2 classes of the Survival Status<jupyter_code>sns.FacetGrid(df,hue='survival status',height=5).map(sns.distplot,'Year of Operation').add_legend()
plt.show()
sns.FacetGrid(df,hue='survival status',height=5).map(sns.distplot,'# Positive axillary nodes detected').add_legend()
plt.show()<jupyter_output><empty_output><jupyter_text>Observation: None of the attributes by themselves are able clearly seperate out the classes of Survival Status Scatter Plots<jupyter_code>sns.set_style("darkgrid")
sns.FacetGrid(df,hue= 'survival status', height=5).map(plt.scatter,'age','Year of Operation').add_legend()
plt.show()<jupyter_output><empty_output><jupyter_text>Observation: It did not really make sense to plot a scatter plot between the Year of Operation attribute and the age attribute<jupyter_code>sns.set_style("darkgrid")
sns.FacetGrid(df,hue= 'survival status',height=5).map(plt.scatter,'age','# Positive axillary nodes detected').add_legend()
plt.show()
sns.set_style("darkgrid")
sns.FacetGrid(df,hue='survival status',height=5).map(plt.scatter,'Year of Operation','# Positive axillary nodes detected')
plt.show()<jupyter_output><empty_output><jupyter_text>Observation: It did not really make sense to plot a scatter plot between the Year of Operation attribute and the age attribute  MultiVariate Analysis<jupyter_code>#Plot BoxPlots to look at the quartile ranges
sns.boxplot(x='survival status', y='age',data= df)
plt.show()<jupyter_output><empty_output><jupyter_text>Observation:Seems like the age attribute is equally distributed across the 2 classes of the survival staus with 50th percentilealmost at 52 years of age and there is no clear distiction<jupyter_code>#Looking at the BoxPlot to look at the quartile ranges
sns.boxplot(x='survival status',y='# Positive axillary nodes detected', data=df)
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.0821421172570955, 'fraction_numerical': 0.034079138181064846, 'mean_word_length': 4.919681177191907, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 50, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '13', 'dir': 'jupyter-structured-clean-dedup', 'id': '352194', 'license': 'Apache-2.0', 'n_tokens_mistral': 3114, 'n_tokens_neox': 2750, 'n_words': 1253, 'path': 'EDA_on_Habermans.ipynb', 'repo_name': 'Anuragh20/Custom-Implementation-of-ML-Algorithms', 'size': '9654'}