<jupyter_start><jupyter_text>Data Visualization Assignment<NAME><jupyter_code># Code source: <NAME>
# Modified for documentation by <NAME>
# License: BSD 3 clause

import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from sklearn import datasets
from sklearn.decomposition import PCA

# import some data to play with
iris = pd.read_csv("iris.xls")
iris.set_index("Id", inplace = True)
iris.head()
x = iris.iloc[:, :-1].values
y = iris.iloc[:,-1].values
iris.Species.unique()#so we have 3 species
#Feature Engineering

#Label Encoding
from sklearn.preprocessing import LabelEncoder
encoder=LabelEncoder()
y=encoder.fit_transform(y)
#Feature Scaling
from sklearn.preprocessing import StandardScaler
scaler=StandardScaler()
x=scaler.fit_transform(x)
#reduce the dimensionality of the dataset
from sklearn.decomposition import PCA
pca=PCA(n_components=3)
x=pca.fit_transform(x)
#Visualizing in 3D chart
from mpl_toolkits.mplot3d import Axes3D
fig=plt.figure(1, figsize=(9,12))   
plt.clf() 
axes=Axes3D(fig)
plt.cla()

axes.scatter(x[:,0], x[:,1], x[:,2], c=y)
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11883802816901408, 'fraction_numerical': 0.01584507042253521, 'mean_word_length': 6.73469387755102, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '307916', 'license': 'Apache-2.0', 'n_tokens_mistral': 430, 'n_tokens_neox': 416, 'n_words': 105, 'path': 'Data Visulaization Assignment/Data Visualization Assignment.ipynb', 'repo_name': 'divyansh1195/iNeuron-Projects-and-Notebooks', 'size': '1161'}