
算法
lpossible
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
c++实现堆排序、快速排序、归并排序
堆排序 #include<iostream> #include<vector> using namespace std; void adjust(vector<int>& v,int i,int index) { int left = 2 * i + 1; int right = 2 * i + 2; int maxid = i; if (left <= index && v[left] > v[maxid]) maxid原创 2021-03-26 17:13:45 · 337 阅读 · 0 评论 -
HMM前向算法
注:该算法即根据观测序列求产生该观测序列的概率 """HMM model forward algorithm""" import numpy as np def possibility(observe): """calculate""" # 假设有三种状态s1,s2,s3定义一个状态转化矩阵 state_transform = np.array([[0.5, 0.3,...原创 2019-11-15 21:12:52 · 281 阅读 · 0 评论 -
python3的主成分分析实现
1 主成分分析 主成分分析是最常用的线性降维方法,他的目标是通过某种线性投影,将高维的数据映射到低维的空间中,并期望在所投影的维度上数据的方差最大,以此使用较少的维度,保留原样本数据,并进行一定的分类效果。 2 代码 import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import ...原创 2019-11-05 17:49:40 · 1236 阅读 · 0 评论 -
python3用回溯法解决八皇后问题(涉及到数组的浅拷贝和深拷贝)
在讲解代码之前,我首先讲一下在做八皇后问题探讨中遇到的问题:数组的浅拷贝和深拷贝问题: 1.浅拷贝 (1)直接赋值 如下如果直接以等号赋值的形式创建另几个数组时,改变这几个数组(包括原数组)中元素的值时,这几个数组中的元素全部都会改变,可以做如下小尝试: a = [1, 2, 3, 4, 5, 6] b = a c = a c[0] = 3 print(a) print(b) print...原创 2019-09-25 16:21:43 · 433 阅读 · 0 评论