Giter Site home page Giter Site logo

c125's People

Contributors

whitehatjr avatar

Stargazers

 avatar

Watchers

 avatar  avatar

c125's Issues

Solution for class 118 Pro.ipynb

from google.colab import files
data_to_load = files.upload()

import pandas as pd
import plotly.express as px

df = pd.read_csv("stars.csv")
print(df.head())

from sklearn.cluster import KMeans
X = df.iloc[:, [0, 1]].values
print( X)

wcss = []
for i in range(1, 11):
kmeans = KMeans(n_clusters=i, init='k-means++', random_state = 42)
kmeans.fit(X)
wcss.append(kmeans.inertia_)

import matplotlib.pyplot as plt
import seaborn as sns

plt.figure(figsize = (10,5))
sns.lineplot(range(1,11),wcss,marker= "o",color = "red")
plt.title("the_elbow_method")
plt.xlabel("number of clusters")
plt.ylabel("wcss")
plt.show()

plt.figure(figsize = (15,7))
sns.scatterplot(X[y_kmeans == 0,0],X[y_kmeans == 0,1],color = "purple",label = "cluster1")
sns.scatterplot(X[y_kmeans == 1,0],X[y_kmeans == 1,1],color = "orange",label = "cluster2")
sns.scatterplot(X[y_kmeans == 2,0],X[y_kmeans == 2,1],color = "pink",label = "cluster3")

sns.scatterplot(kmeans.cluster_centers_[:,0],kmeans.cluster_centers_[:,1],color = "red",label = "centroid",s = 100,markers=",")
plt.grid(False)
plt.title("cluster of stars")
plt.xlabel("stars")
plt.ylabel("light")
plt.legend()
plt.show()

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.