다음은 IEEE Fraud dataset에서 V1~340으로 표시된 feature를 줄이는 예제이다. sc = preprocessing.MinMaxScaler()pca = PCA(n_components=2) # 2개로!vcol_pca = pca.fit_transform( sc.fit_transform( all_data[vcols].fillna(-1) ) # na값 최소값인 -1로하고 minmax! 한후에 pca!!) all_data['_vcol_pca0'] = vcol_pca[:, 0] # PCA로 2개가 나왔을테니 그중 1개를 피처all_data['_vcol_pca1'] = vcol_pca[:, 1] # PCA로 2개가 나왔을테니 그중 1개를 피처all_data['_vcol_nulls'] = all_d..
def plot_count(feature, title, df, size=1): f,ax = plt.subplots(1,1,figsize=(4*size, 4)) total = float( len(df) ) g = sns.countplot(df[feature], order=df[feature].value_counts().index[:30], palette='Set3') g.set_title(F"Number and percentage of {title}") if( size > 2 ): plt.xticks(rotation=90, size=8) for p in ax.patches: height = p.get_height() ax.text(p.get_x() + p.get_width()/2., height + 3, ..
def print_train_test_diff(trainset, testset): temp_df = pd.DataFrame() for column in list(trainset.columns.values): field_type = trainset[column].dtype try: temp_df = temp_df.append( pd.DataFrame( { 'column' : column, 'train': trainset[column].nunique(), 'test' : testset[column].nunique(), 'type' : field_type }, index = [0] ) ) except: "Error trying to add target from test" # testset에 target값이 없..
def missing_data(data): total = data.isnull().sum() percent = (data.isnull().sum()/data.isnull().count() * 100) tt = pd.concat( [total, percent], axis=1, keys=['Total', 'Percent'] ) types = [] for col in data.columns: dtype = str(data[col].dtype) types.append(dtype) tt['Types'] = types return (np.transpose(tt))
" 브라우저 밖의 JavaScript " node 치면 콘솔창에서도 javaScript를 사용할 수 있음 (일부 예외 alert같은거) javascript는 원래 브라우저에 종속되어있었는데, nodejs가 탄생함으로써 그 관계를 벗어날 수 있게됨.
https://www.quora.com/What-is-the-difference-between-a-web-application-and-a-web-site -WebSite Websites are basically collections of web pages. You access them using a browser. You're basically just supposed to read and look at everything that's on a website, and that's the majority of your experience as a user. When you read the content on a website, your goal is to learn something and to absor..
https://www.youtube.com/playlist?list=PLWKf9beHi3TgstcIn8K6dI_85_ppAxzB8
https://www.npmjs.com/package/helmet Helmet helps you secure your Express apps by setting various HTTP headers. It's not a silver bullet, but it can help! helmet은 http header을 보안해주는 역할을 한다. import helmet from "helmet"; app.use(helmet());