depy2016's People
Forkers
michaelreinhard phammanhhiep moondra absarf fitrialif camronkhan johntekdek mesandipdatta ravideep ibrahim85 xavtx1 andrewricardo nuelsitanggang sdiluise iamblichus esha-swaroop kishorkukreja petroffss joyskie soseji40 limitless083 bodeoni yashwantreddy msoancah ramkumars1985 fernandoplato gurasees1 akhileshkumargangwar osman705 vneogi199 renjithmadhavan occam-khs dadao999 abhinavsuraj sandhuram hope25 kskand mikess314 pkl520 singhshashwat wwwyuanstar akhill10 aayancheng atwine sampanna-sharma aaneloy alomdaelmasry prabz lminy niroop93 ekapti leebaro genesis-harvey lukamrpython david-rad pravn14 athiaga1 rajnish734 truth8d ibozkurt79 mikeoriordain moulindu ajax6255 hameem1 bipuboy gilly1234 x00119137 hephtechy rahultaneja111 feros5 reallyz ashdwh chotheraviraj gabeochieng jerry1ye10 rastogi-sachin upendra117 arivolirajan jinojck cebalosb iykemadu veraququ hycene siam180 htorres00 lincolnassy usmanalhaji balivada987 rorymck sameer1990 jawa007 miaojunlee damielcowen etnarojas santoshik29 cuixin421 khaifagifari skaiphd rtom87 shuan3depy2016's Issues
When I run add_interactions(X), I throw an error. Help, please? Newbie here.
def add_interactions(df):
# Get feature names
combos = list(combinations(list(df.columns), 2))
colnames = list(df.columns) + ['_'.join(x) for x in combos]
# Find interactions
poly = PolynomialFeatures(interaction_only=True, include_bias=False)
df = poly.fit_transform(df)
df = pd.DataFrame(df)
df.columns = colnames
# Remove interaction terms with all 0 values
noint_indicies = [i for i, x in enumerate(list((df == 0).all())) if x]
df = df.drop(df.columns[noint_indicies], axis=1)
return df
X = add_interactions(X)
print(X.head())
Traceback (most recent call last):
File "/Users/andrewricardo/Desktop/Python Projects/adult_DecisionTree5_27.py", line 88, in
X = add_interactions(X)
File "/Users/andrewricardo/Desktop/Python Projects/adult_DecisionTree5_27.py", line 78, in add_interactions
df = poly.fit_transform(df)
File "//anaconda/lib/python3.6/site-packages/sklearn/base.py", line 494, in fit_transform
return self.fit(X, **fit_params).transform(X)
File "//anaconda/lib/python3.6/site-packages/sklearn/preprocessing/data.py", line 1258, in fit
n_samples, n_features = check_array(X).shape
File "//anaconda/lib/python3.6/site-packages/sklearn/utils/validation.py", line 402, in check_array
array = array.astype(np.float64)
ValueError: could not convert string to float: 'United-States '
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.