testessays文字部分看得见吗
12345self.max_eig_vector = self.eig_vector[:, np.argmax(self.eig_val)].real# 矩阵的一致性指标CIself.CI_val = (self.max_eig_val - self.n) / (self.n - 1)# 矩阵的一致性比例CRself.CR_val = self.CI_val / (self.RI_list[self.n - 1])
essays
未读连续数据离散化方法1.分位数法:使用四分位、五分位、十分位等进行离散2.距离区间法:等距区间或自定义区间进行离散,有点是灵活,保持原有数据分布3.频率区间法:根据数据的频率分布进行排序,然后按照频率进行离散,好处是数据变为均匀分布,但是会更改原有的数据结构4.聚类法:使用k-means将样本进行离散处理5.卡方:通过使用基于卡方的离散方法,找出数据的最佳临近区间并合并,形成较大的区间6.二值化:数据跟阈值比较,大于阈值设置为某一固定值(例如1),小于设置为另一值(例如0),然后得到一个只拥有两个值域的二值化数据集。
时间序列离散1234567891011import pandas as pdfrom sklearn.cluster import KMeansfrom sklearn import preprocessing#######时间序列离散######## 创造时间数据date = pd.date_range('03/17/2018','03/17/2023')df_t = pd.DataFrame(date, columns=[ ...
python
未读python开发中常用代码1、让代码既可以被导入又可以被执行
1if __name__ == '__main__':
2、逻辑判断
12345name = 'jelly'fruits = ['apple','orange','grape']owners = {'101':'应敏婕','102':'罗一芳'} if name and fruits and owners: print('应敏婕 love friuts 罗一芳')
3、善用in
12if 'I' in name: print('this is a l in it!')
4、不使用临时变量替换两个值
1a,b=b,a
5、EAFP优于LBYL。
123EAFP - Easier to Ask Forgiveness than Permission.LBYL - L ...
相关信息的传入和准备1234567891011121314151617181920import numpy as npclass AHP: def __init__(self, array): ## 记录矩阵相关信息 self.array = array ## 记录矩阵大小 self.n = array.shape[0] # 初始化RI值,用于一致性检验 self.RI_list = [0, 0, 0.52, 0.89, 1.12, 1.26, 1.36, 1.41, 1.46, 1.49, 1.52, 1.54, 1.56, 1.58, 1.59] # 矩阵的特征值和特征向量 self.eig_val, self.eig_vector = np.linalg.eig(self.array) # 矩阵的最大特征值 self.max_eig_val = np.max(self.eig_val) ...
New Start HereStarting from 2024/2/7, it’s a new start.Now it’s 0:57 and the site, From 7 PM on February to rebuild the blog, to now has passed a day, hoping to organize my own ideas on this website, but also as an online cloud warehouse.
This website will continue to update, the recent task is interpretable machine learning common methods,mathematical modeling methods, occasionally will update the precious fragments of life, look forward to it ~
Thought at the momment`Today is the ...
Python数学建模常用算法
未读相关信息的传入和准备123456789101112131415161718192021222324import numpy as npclass AHP: """ 相关信息的传入和准备 """ def __init__(self, array): ## 记录矩阵相关信息 self.array = array ## 记录矩阵大小 self.n = array.shape[0] # 初始化RI值,用于一致性检验 self.RI_list = [0, 0, 0.52, 0.89, 1.12, 1.26, 1.36, 1.41, 1.46, 1.49, 1.52, 1.54, 1.56, 1.58, 1.59] # 矩阵的特征值和特征向量 self.eig_val, self.eig_vector = np.linalg.eig(self.array) ...