# GMM model# 2015/7/22library(mvtnorm)set.seed(1)n1 = 1000n2 = 1000mu1 = c(0,1)mu2 = c(-5,-6)sigma1 = matrix(c(1,.5,.5,2),nrow=2)sigma2 = matrix(c(2,....
分类:
其他好文 时间:
2015-07-28 22:41:08
阅读次数:
125
example 1:string str("Hello, world!");BOOST_FOREACH(char c, str){ cout matrix_int;BOOST_FOREACH( std::vector& row, matrix_int ) BOOST_FOREACH( int & ....
分类:
其他好文 时间:
2015-07-28 20:33:29
阅读次数:
488
题目地址:POJ 3318
题意:有3个n*n的矩阵A,B,C,问AB是否等于C。
思路:题目描述很简单,就是用矩阵乘法,但是很明显矩阵乘法的时间复杂度为O(n^3),很明显超时。那怎么改进呢?就是用压缩矩阵的方法:
设矩阵R是1*n的矩阵,根据矩阵的性质,若A*B*R=C*R,那么A*B=C。由此可以看出来,虽然多成了一个矩阵,但是时间复杂度成了O(n^2)。那么问题是这个R的行列式该怎么设...
分类:
其他好文 时间:
2015-07-28 13:12:37
阅读次数:
94
Given an integer matrix, find a submatrix where the sum of numbers is zero. Your code should return the coordinate of the left-up and right-down numbe...
分类:
其他好文 时间:
2015-07-28 06:40:25
阅读次数:
139
numpy函数库中一些常用函数的记录最近才开始接触python,python中为我们提供了大量的库,不太熟悉,因此在《机器学习实战》的学习中,对遇到的一些函数的用法进行记录。(1)mat( )numpy函数库中存在两种不同的数据类型(矩阵matrix和数组array),都可以用于处理行列表示的数字元素。虽然他们看起来很相似,但是在这两个数据类型上执行相同的数学运算可以得到不同的结果,其中numpy函...
分类:
其他好文 时间:
2015-07-27 21:00:14
阅读次数:
128
Search a 2D Matrix II: python学了还么两周可能有些地方写的很新手大家不要笑我 解题思路: 首先当数组为1维数组时if in 直接查找即可 当为 m x n 维数组时: matrix为行增列增的有序矩阵 所以对行和列采用折半...
分类:
其他好文 时间:
2015-07-27 19:16:19
阅读次数:
150
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area.For example, given the following matrix:1 0 1 0 0
1 0 1 1 1
1 1 1 1 1
1 0 0 1 0
Return ...
分类:
其他好文 时间:
2015-07-27 19:12:53
阅读次数:
106
一看正确率这么高,以为是水题可以爽一发,结果是没怎么用过的矩阵快速幂,233题解链接:点我 1 #include 2 #include 3 const int N=10; 4 using namespace std; 5 int k,m; 6 struct Matrix{ 7 int map...
分类:
其他好文 时间:
2015-07-27 18:07:11
阅读次数:
94
import random
import copy
EPS = 0.00001
class MatrixException( Exception ):
pass
class Matrix( object ):
def __init__( self, rows, cols, values_list = None, description = None ): ...
分类:
其他好文 时间:
2015-07-27 09:31:40
阅读次数:
107
参考:http://scikit-learn.org/stable/modules/preprocessing_targets.html
没什么好翻译的,直接给例子。
1、Label binarization
LabelBinarizer is
a utility class to help create a label indicator matrix from...
分类:
其他好文 时间:
2015-07-26 19:18:24
阅读次数:
216