Comments (2)
note the minhashencoder has the same issue
>>> import pandas as pd
>>> import numpy as np
>>> from skrub import MinHashEncoder
>>> encoder = MinHashEncoder(n_components=2)
>>> df = pd.DataFrame(dict(a=["one", None, "one"]))
>>> df
a
0 one
1 None
2 one
>>> df.isna()
a
0 False
1 True
2 False
>>> _ = encoder.fit_transform(df)
>>> df
a
0 one
1 NAN
2 one
>>> df.isna()
a
0 False
1 False
2 False
from skrub.
here is a way to still keep the default preprocessing while adding the nan handling; CountVectorizer exposes a public build_preprocessor() function:
>>> from sklearn.feature_extraction.text import CountVectorizer
>>> x = ['abcd', 'abcd', 'cdef', None]
>>> default_preprocessor = CountVectorizer().build_preprocessor()
>>> def preprocessor(text):
... return default_preprocessor(text) if isinstance(text, str) else ''
>>> v = CountVectorizer(analyzer='char', preprocessor=preprocessor)
>>> v.fit_transform(x).A
array([[1, 1, 1, 1, 0, 0],
[1, 1, 1, 1, 0, 0],
[0, 0, 1, 1, 1, 1],
[0, 0, 0, 0, 0, 0]])
from skrub.
Related Issues (20)
- Add a "DropSimilar" transformer
- Example 08_join_aggregation broken HOT 4
- aggtarget with small dataframe
- AggTarget raises when y is a Series HOT 1
- Scikit-learn v1.5 breaks skrub HOT 4
- `drop_nulls` and `is_null` have a different behavior for polars and pandas HOT 1
- Follow-ups after #902
- adding `make_learner` to create a default pipeline for a given predictor
- Shorthand for getting only the preprocessing part of the TableVectorizer HOT 2
- AggJoiner raises exceptions when trying to join multiple tables at once HOT 5
- Faster alternative to GapEncoder HOT 1
- Display columns with the HTML representation of the fitted TableVectorizer
- `fetch_ken_embeddings` does not use `suffix` with default parameter HOT 1
- Ken embeddings RAM and disk usage HOT 2
- `SingleColumnTransformer`s don't work with `ColumnTransformer` HOT 4
- Port from sckikit-learn the positioning of the example buttons on downloading, jupyter-lite...
- Jupyter-lite picks up old versions of the examples? HOT 3
- Thebe + jupyterlite on the landing page
- Regroup developer docs in the main sphinx documentation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from skrub.