Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
IrtezAhmed committed Oct 18, 2020
1 parent 0185885 commit 49ea32e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

userLocation = st.selectbox("Where do you live right now?", rows)
#st.write(userLocation)

userDistance = st.slider("How far are you willing to move away?", 0, 10000, 0, 200)
userPop = st.slider("How populated do you want this city to be? (1 = Sparse, 5 = Crowded)", 1, 5, 1)
userRent = st.slider("How much rent are you willing to pay? (Specify a range)", 600, 22000, (3000, 6000), 100)
Expand All @@ -47,7 +48,7 @@

st.write(result)

model = KMeans(n_clusters = 8, n_init=100, init='random')
model = KMeans(n_clusters = 100, n_init=100, init='random')
model.fit(result)

labels = model.predict(result)
Expand All @@ -66,10 +67,10 @@
n+=1

#printing the dictionary out
'''for clusterNum in clusterDict:
for clusterNum in clusterDict:
st.write("Cluster Number:", clusterNum)
for city in clusterDict[clusterNum]:
st.write(city)'''
st.write(city)

#distance to center of cluster --> convert to DF
'''clusterDistance = model.transform(result)**2
Expand Down Expand Up @@ -98,9 +99,9 @@
# math.sqrt(((lat2 - lat1)*111)**2 + ((lon2 - lon1)*111)**2)
# st.write(math.sqrt(((result["lat"][1] - result["lat"][2])*111)**2 + ((result["lng"][1] - result["lng"][2])*111)**2))
#May need to multiply final answer by a certain amount
fig = px.scatter_mapbox(result, lat="lat", lon="lng", color="population", hover_name=rows, hover_data=['Average Rental Cost',"Temp"], size="density",
'''fig = px.scatter_mapbox(result, lat="lat", lon="lng", color="population", hover_name=rows, hover_data=['Average Rental Cost',"Temp"], size="density",
color_continuous_scale=px.colors.diverging.RdYlGn, zoom=1, mapbox_style="carto-positron", size_max=15)
fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0})
st.plotly_chart(fig)
st.plotly_chart(fig)'''

0 comments on commit 49ea32e

Please sign in to comment.