text_html_output_1.png
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis

import pandas as pd

import plotly.express as px

glass = pd.read_csv('/kaggle/input/glass/glass.csv')

X = glass.copy().drop(['Type'], axis=1)
y = glass['Type'].copy()

from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
lda_model = LinearDiscriminantAnalysis(n_components=2)
lda_model.fit(X, y)
reduced_X = lda_model.transform(X).T

fig = px.scatter(
    glass, 
    x=reduced_X[0], 
    y=reduced_X[1], 
    color="Type", 
    hover_data=['Type'],
    color_continuous_scale='portland')
fig.show()

fig = px.scatter(glass, x='Mg', y='Fe', color='Type', color_continuous_scale='portland')
fig.show()