Commit 51bce992 authored by tchervec's avatar tchervec
Browse files

Merge branch '64-sklearn-neighbors-_kd_tree-kdtree-object-is-not-subscriptable' into 'develop'

Resolve "'sklearn.neighbors._kd_tree.KDTree' object is not subscriptable"

See merge request ivt-vpl/populations/ch-zh-synpop!97
parents a3ac649a c5f55d58
import numpy as np
import numpy.linalg as la
import pandas as pd
......
......@@ -59,7 +59,7 @@ def execute(context):
df_mz_households["number_of_bikes"] >= df_mz_households["household_size"],
"number_of_bikes_class"] = c.BIKE_AVAILABILITY_FOR_ALL
# Houeshold size class
# Household size class
data.utils.assign_household_class(df_mz_households)
# Region information
......@@ -86,12 +86,12 @@ def execute(context):
df_mz_households["home_zone_id"] = df_mz_households["zone_id"]
# Impute density
data.statpop.density.impute(context, context.stage("data.statpop.density"), df_mz_households, "home_x", "home_y")
data.statpop.density.impute(context.stage("data.statpop.density"), df_mz_households, "home_x", "home_y")
# Impute OV Guteklasse
print("Imputing ÖV Güteklasse ...")
df_ovgk = context.stage("data.spatial.ovgk")
df_spatial = data.spatial.utils.impute(context, df_ovgk, df_spatial, ["person_id"])
df_spatial = data.spatial.ovgk.impute(context, df_ovgk, df_spatial, ["person_id"])
df_mz_households = pd.merge(df_mz_households, df_spatial[["person_id", "ovgk"]], on=["person_id"], how="left")
# Wrap it up
......
......@@ -15,7 +15,7 @@ def impute(df_mz):
# TODO: Maybe adjusted later!
classifier = sklearn.tree.DecisionTreeClassifier(min_samples_leaf = 30, max_depth = 5)
classifier.fit(None, training_data, training_labels)
classifier.fit(X=training_data, y=training_labels, sample_weight=None)
# Predict the incomes
prediction_data = df_mz[no_income_selector][[
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment