This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
knn_impute(target=df['Age'], attributes=df.drop(['Age', 'PassengerId'], 1), | |
aggregation_method="median", k_neighbors=10, numeric_distance='euclidean', | |
categorical_distance='hamming', missing_neighbors_threshold=0.8) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
knn_impute(target=df['Age'], attributes=df.drop(['Age', 'PassengerId'], 1), | |
aggregation_method="median", k_neighbors=10, numeric_distance='euclidean', | |
categorical_distance='hamming', missing_neighbors_threshold=0.8) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pandas as pd | |
from collections import defaultdict | |
from scipy.stats import hmean | |
from scipy.spatial.distance import cdist | |
from scipy import stats | |
import numbers | |
def weighted_hamming(data): |