自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(8)
  • 收藏
  • 关注

原创 R语言Rcpp包编写矩阵/向量相乘

在R中使用C++命令以达到加快矩阵运算的目的

2022-10-24 16:54:29 472 1

原创 woe编码对于少部分离散变量和大部分的离散变量

from woe_bin import woe_binimport sysdef woe_bin(merge_data,label): wb = woe_bin(indata = merge_data, target=label, min_group_rate=0.05, max_bin=6, bin_method='mono', alg_method='iv') #print(wb) mapiv = wb.split_data() #print(mapiv) .

2022-02-15 17:51:07 515

原创 离散值分箱

def chi12(np_regroup,confidence=4,bins=20): #设定自由度为1,卡方阈值为3.841,最大分箱数20#对相邻两个区间的值进行卡方计算chi_table = np.array([]) #创建一个数组保存相邻两个区间的卡方值index = []for i in np.arange(np_regroup.shape[0]-1):for j in np.arange(i+1,np_regr...

2021-12-21 16:33:12 334

原创 连续值分箱

def chi_bins(df,col,target,confidence=3.841,bins=20): #设定自由度为1,卡方阈值为3.841,最大分箱数20total = df[target].count() #计算总样本数bad = df[target].sum() #计算坏样本总数good = total - bad #计算好样本总数total_bin = df.groupby([col])[target].count() #...

2021-12-21 16:32:05 188

原创 python向前逐步回归

一,向前逐步回归,相除多重共线性import statsmodels.formula.api as smfdef forward_selected(data, response):"""Linear model designed by forward selection.Parameters:-----------data : pandas DataFrame with all possible predictors and respons...

2021-12-21 16:15:40 710

原创 交叉验证方法

num = np.zeros(15,dtype = np.float64)i = 0kf = KFold(n_splits = 5,shuffle = True ,random_state = 2021)for n_fold, (trn_idx, val_idx) in enumerate(kf.split(X_data)): x_train, y_train = X.iloc[trn_idx], Y.iloc[trn_idx] x_test, y_test = X.iloc[val...

2021-11-12 20:24:30 1273

原创 python时间戳转化成日期数据,日期数据与当前日期加减

import timeimport datetimeimport numpy as np#n = len(X_train['create_time'])#np.zeros(n,dtype = np.int32)####################单个转换时间戳为时间def changetime(x): timeArray = time.localtime(x) otherStyleTime = time.strftime("%Y-%m-%d %H:%M:%S", timeAr...

2021-11-11 22:59:29 914

原创 logistic SVM RF 的运行代码

from sklearn.linear_model import LogisticRegressionfrom sklearn.preprocessing import StandardScalerfrom sklearn.pipeline import make_pipelinefrom sklearn.metrics import mean_squared_errorfrom sklearn.metrics import roc_auc_score###########logistic.

2021-11-11 11:11:46 969

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除