摘要:
pd.read_csv(file, nrows = 100) df.iloc[: 100, :].to_csv(out_file, index = False) Linux下查看前100行: head -100 123.txt 阅读全文
摘要:
相关资料收集: 1. 百度百科:https://baike.baidu.com/item/%E5%BC%A0%E4%B8%80%E9%B8%A3/15898544?fr=aladdin 2. https://www.tmtpost.com/123328.html 《张一鸣,他的每一句话都在被挑错》 阅读全文
摘要:
推荐参考:https://www.freesion.com/article/4488859249/ 实际运用时注意: F.binary_cross_entropy_with_logits()对应的类是torch.nn.BCEWithLogitsLoss,在使用时会自动添加sigmoid,然后计算lo 阅读全文
摘要:
官网:https://pytorch.org/docs/stable/data.html?highlight=subsetrandomsampler#torch.utils.data.SubsetRandomSampler 推荐参考:https://www.sohu.com/a/291959747_ 阅读全文
摘要:
for i in categorical_ix: le = joblib.load(f"./LabelEncoder/{i}_LabelEncoder.model") #由于test集合中可能出现新的label,没有在train中出现过,因此将新的标签也转为<unk> test_labels = d 阅读全文
摘要:
from torch.utils.data import Dataset from torch.utils.data import DataLoader from torch.utils.data import sampler import numpy as np import torch clas 阅读全文
摘要:
1. 保存list import numpy as np a = [1,2,3,4,5] np.save("number.npy", a) k = np.load("number.npy") 2. 保存map import json data = {} data["a"] = 1 data["b"] 阅读全文
摘要:
# 3.离散值进行LabelEncoder #处理数据的三个步骤,去重,处理缺失值,离散值LabelEncoder from sklearn import preprocessingfrom sklearn.externals import joblib categorical_ix = ["1", 阅读全文
摘要:
# 2.1处理缺失值,连续值用均值填充 continuous_fillna_number = [] for i in train_null_ix: if(i in continuous_ix): mean_v = df_train[i].mean() continuous_fillna_number 阅读全文
摘要:
s = df.isnull().any() #返回series形式,可以用enumerate打印s #true代表有空值 null_index = [] for i,j in enumerate(s): print(i,j,s.index[i]) if(j): null.index.append(s 阅读全文