Skip to content

Instantly share code, notes, and snippets.

View thomas-chauvet's full-sized avatar

Thomas thomas-chauvet

View GitHub Profile
@thomas-chauvet
thomas-chauvet / elastic_search_function_score_dense_vector.py
Created January 29, 2020 13:04
[Elasticsearch] Function score as post-processing, doesn't apply at query time: leading to confusing results
from elasticsearch import Elasticsearch
import pprint
import time
if __name__ == '__main__':
ELASTICSEARCH_HOST = "localhost"
ELASTICSEARCH_PORT = "9200"
index_name = "vector_index"
@thomas-chauvet
thomas-chauvet / one_hot_encoder_column_names_pandas.py
Created January 4, 2019 11:10
Get column names after one hot encoding by scikit-learn.
"""
Get column names after one hot encoding by scikit-learn.
"""
from sklearn.preprocessing import OneHotEncoder
import pandas as pd
titanic_url = ('https://raw.githubusercontent.com/amueller/'
'scipy-2017-sklearn/091d371/notebooks/datasets/titanic3.csv')
data = pd.read_csv(titanic_url).loc[:,["sex", "embarked", "pclass"]].dropna()
data.head()