自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 SVD奇异值分解

本文由LeftNotEasy发布于http://leftnoteasy.cnblogs.com奇异值与特征值基础知识:特征值分解和奇异值分解在机器学习领域都是属于满地可见的方法。两者有着很紧密的关系,我在接下来会谈到,特征值分解和奇异值分解的目的都是一样,就是提取出一个矩阵最重要的特征。先谈谈特征值分解吧:   1)特征值:    如果说一个向量v是方阵A的特征向量

2017-10-31 17:13:27 223

原创 图的连通性判断

判断图的连通性,程序目的是为了检验一个网络是否为联通的,如果不连通,会将小的区块的节点号报出。#include <iostream>#include <cstdio>#include <vector>#include<fstream>#include<string>#include<iomanip>using namespace std;const int maxn = 1000 + 5

2017-08-03 10:37:19 1624

原创 AHP层次分析法

clc;clear;A=[1 3/4 3/9 3/8 3/6; 4/3 1 4/9 4/8 4/6; 9/3 9/4 1 9/8 9/6; 8/3 8/4 8/9 1 8/6; 6/3 6/4 6/9 6/8 1] %因素对比矩阵A,只需要改变矩阵A[m,n]=size(A);

2015-07-27 14:22:51 1412

原创 K-means算法

%N是数据一共分多少类%data是输入的不带分类标号的数据%u是每一类的中心%re是返回的带分类标号的数据function [u re]=KMeans(data,N) [m n]=size(data); %m是数据个数,n是数据维数 ma=zeros(n); %每一维最大的数 mi=zeros(n); %每一维最小的数 u

2015-07-27 14:20:15 348

原创 Machine Learning week 4 One vs All and Neural network

1、Vectorizing Logistic Regressionfunction [J, grad] = lrCostFunction(theta, X, y, lambda) %LRCOSTFUNCTION Compute cost and gradient for logistic regression with %regularization % J = LRCOSTFUN

2015-07-20 22:14:38 519

原创 BP网络范例 MATLAB

clcclearcd C:\Users\ASUS1\DesktopA=xlsread('第二题数据.xls');p=A(:,1:4)';t=A(:,5)';[pn,minp,maxp,tn,mint,maxt]=premnmx(p,t);%原始数据归一化?net=newff(pn,tn,[9],{'tansig','purelin'},'traingdx');%设置网络,建立相应的BP

2015-07-17 14:03:23 418

原创 Stanford machine learing Part 1 Linear Regression

代码汇总: computeCost:代价函数function J = computeCost(X, y, theta)%COMPUTECOST Compute cost for linear regression% J = COMPUTECOST(X, y, theta) computes the cost of using theta as the% parameter for l

2015-07-13 14:17:06 285

原创 SQL语句

一、基础  1、说明:创建数据库  CREATE DATABASE database-name  2、说明:删除数据库  drop database dbname  3、说明:备份sql server  --- 创建 备份数据的 device  USE master  EXEC sp_addumpdevice 'disk', 'tes

2015-06-30 19:06:18 259

原创 linux指令

一些linux的指令 linux 基本命令 ls     (list 显示当前目录下文件和目录 ls -l 详细显示 =ll ) [root@linux ~]# ls [-aAdfFhilRS] 目录名称 [root@linux ~]# ls [--color={none,auto,always}] 目录名称 [root@linux ~]# ls [--full-t

2015-06-30 19:01:07 374

原创 morley's theorem uva11178

1、问题描述 2、只用利用直线交点求解即可,注意三分线可以用Rotate函数更新#include <iostream>#include<cmath>using namespace std;/* run this program using the console pauser or add your own getch, system("pause") or input loop */str

2015-06-11 09:35:19 327

原创 二维平面几何

二维平面几何中关于向量运算的实现#include <iostream>#include<cmath>using namespace std;/* run this program using the console pauser or add your own getch, system("pause") or input loop */struct point{ double x,y

2015-06-11 09:30:43 358

原创 545B Equidistant string

1、问题描述 2、仅贪心算法即可,由高位到低位逐位变化,并判断。#include <iostream>#include<cstring>using namespace std;/* run this program using the console pauser or add your own getch, system("pause") or input loop */#define

2015-05-22 23:12:04 378

原创 zju1019-lllusive chase(搜索算法)

1、问题描述 2、问题简化的一个步骤是对两点之间是否存在障碍物的判断:通过统计某一区间之间障碍的数量,并用以作差来判断给定区间内是否存在障碍物;决策树在本题是十分明显的,是通过每一step来进行的,同一step层内,有若干子节点,可以进行分类(DFS搜索)3、#include <iostream>#include<cmath>#include<cstring>using namespace

2015-05-22 21:26:40 580

原创 cf545A

1、问题描述 2、本题细节众多,注意所给两个条件,其一为矩阵是问题意义上对称的,其二,质量的判断一次即决定,没必要重复判断。可以在输入过程中判断3、#include <iostream>#include<cstring>#include<set>using namespace std; /* run this program using the console pauser or add

2015-05-21 14:24:58 376

原创 cf543B

1、问题描述 2、本题如果对于小数据集的话仅用数组来记录边即可,考虑到要判断多个点之间的最短路,故考虑用Floyd算法来求,该算法在点组更多的情况下会更有价值,然后就是对每条边进行取舍来形成一个二叉树形式的决策树。递归求解问题#include <iostream>#include<cmath>#include<cstring>using namespace std; /* run this

2015-05-17 21:10:15 684

原创 5-4交换学生uva10763

1、问题描述 2、有配对的方式,我们考虑到可以用图的比拟方法来近似,可建立邻接表,对每一个新的“坐标”,我们可以对其进行审查,来确定是否插入邻接表。#include <iostream>#include<vector>using namespace std;/* run this program using the console pauser or add your own getch, s

2015-05-17 19:41:55 610

原创 5-3卡片游戏 uva10935

1、问题描述: Problem B: Throwing cards away I Given is an ordered deck of n cards numbered 1 to n with card 1 at the top and card n at the bottom. The following operation is performed as long as there a

2015-05-17 19:35:52 397

原创 5-2DUCCI序列 uva1594

1、问题描述:A Ducci sequence is a sequence of n-tuples of integers. Given an n-tuple of integers (a1, a2, … , an), the next n-tuple in the sequence is formed by taking the absolute differences of neighborin

2015-05-17 19:30:44 491

原创 5-1 代码对齐 UVA1593

1、问题描述: You are working in a team that writes Incredibly Customizable Programming Codewriter (ICPC) which is basically a text editor with bells and whistles. You are working on a module that takes a p

2015-05-17 19:25:19 326

原创 zoj1002 FIRE NET(搜索算法DFS)

1、问题描述 2、对每个单元格进行标号,然后递归,对每个单元格采取能放则放和不放两种决策。形成决策树。 3、`#include includeusing namespace std; /* run this program using the console pauser or add your own getch, system(“pause”) or input loop */define

2015-05-15 13:23:02 494

原创 zoj1074 TO THE MAX(动态规划)

1、问题描述 2、用数组b表示数组a的i~j行对应列元素的和,然后对数组b计算最大字段和,这就将二维动态规划问题转化为一维动态规划的问题。#include <iostream>#include<cstring>using namespace std; /* run this program using the console pauser or add your own getch, sys

2015-05-15 12:31:54 461

原创 Dijkstra算法

采用BFS搜索,因为bfs比dfs有微弱优势#include <iostream>#include<vector>#include<queue>#include<cstring>using namespace std; const int maxn=1000+10;/* run this program using the console pauser or add your own g

2015-05-15 09:48:11 291

原创 无根树有根树转化

算法如下,采取DFS遍历#include <iostream>#include<vector>#include<cstring>using namespace std; /* run this program using the console pauser or add your own getch, system("pause") or input loop */int p[100];/

2015-05-15 09:43:57 483

原创 增广路 EdmondsKarp算法

最大流问题中求解 可以当做模板直接使用#include <iostream>#include<vector>#include<queue>#include<cstring>using namespace std; const int maxn=1000+10;/* run this program using the console pauser or add your own get

2015-05-15 09:40:06 397

原创 例题11-4 电话圈 uva247

1、问题描述 2、首先用floyd求出传递闭包,用g[i][j]表示i是否直接或者间接给j打过电话,当且仅当g[i][j]=g[j][i]时二者处于同一个电话圈。然后在访问连通子集。鉴于题目中有太多的名字,我们可以用pair或者map进行命名,甚至仅仅是数组即可 3、#include<iostream>#include<cstring>#include<map>#include<strin

2015-05-14 21:45:47 346

原创 例题11-2 苗条的生成树 UVa1395 Kruskal算法样例(基于并查集,which is almost like set)

1、题目链接 2、首先把权值排序。对于连续的边集区间[L,R],如果这些边使n个点全部连通(用并查集,逐步扩大连通集),则存在。 从小到大枚举L,从R=L开始,添加n个边,用并查集将这些边的端点合为一个并查集。#include<iostream> #include<algorithm> #include<vector> using namespace std; #define N

2015-05-14 20:21:11 556

原创 e5-7uva136 丑数

1、问题描述: Ugly numbers are numbers whose only prime factors are 2, 3 or 5. The sequence 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, … shows the first 11 ugly numbers. By convention, 1 is included. Write a progr

2015-05-14 13:33:12 381

原创 IOstream 标准库

C++ 的输入/输出(input/output)由标准库提供。 标准库定义了一族类型,支持对文件和控制窗口等设备的读写(IO)。 还定义了其他一些类型,使 string对象能够像文件一样操作,从而使我们无须 IO 就能实现数据与字符之间的转换。 这些 IO 类型都定义了如何读写内置数据类型的值。前面的程序已经使用了多种 IO 标准库提供的工具: ? istream(输入流)类型,提供输入操作

2015-05-14 12:31:02 358

原创 STL:迭代器

1、前向迭代器 2、插入型迭代器 back_inserter(ob)(调用push_back函数) front_inserter(ob)(调用push_front函数)//只能用在deque和list容器上 Inserter(ob,pos)(调用insert(pos,value)) !!不要忘记以上均为Iterator类型的,并非函数 eg:int dim[]={1,2,3,4,5,6,

2015-05-14 12:07:20 431

原创 e5-5uva12096

1、问题。。。由程序还原吧 2、本题的亮点在于#define all(x) x.begin(),x.end()#define ins(x) inserter(x,x.begin())可以在算法中节省很多的代码量 set_union(all(x1),all(x2),ins(x))(完整版:set_union(x1.begin(),x1.end(),x2.begin(),x2.end(),x,x.

2015-05-14 00:11:12 335

转载 Html5新标签解释及用法

HTML 5 是一个新的网络标准,目标在于取代现有的 HTML 4.01, XHTML 1.0 and DOM Level 2 HTML 标准。它希望能够减少浏览器对于需要插件的丰富性网络应用服务(plug-in-based rich internet application,RIA),如Adobe Flash, Microsoft Silverlight, 与 Sun JavaFX 的需求。

2015-05-13 21:41:06 236

原创 STL中的算法

1、for_each(Iterator begin,Iterator end,proc op) 方便处理每一个元素 eg:void print(int item){cout<<elem<<endl;}vector<int>l;Fillvalue(l,1,10);for_each(l.begin(),l.end(),print)2、count(Iterator begin,Iterat

2015-05-13 21:28:52 199

原创 e5-6UVA540

1、问题描述: Queues and Priority Queues are data structures which are known to most computer scientists. The Team Queue, however, is not so well known, though it occurs often in everyday life. At lunch tim

2015-05-07 21:57:39 425

原创 e5-4 uva165

1、问题描述 Download as PDFMost crossword puzzle fans are used to anagrams–groups of words with the same letters in different orders–for example OPTS, SPOT, STOP, POTS and POST. Some words however do not h

2015-05-06 22:59:59 330

原创 字符串分割函数strtok()

分解字符串为一组字符串。s为要分解的字符串,delim为分隔符字符串。例如:strtok("abc,def,ghi",","),最后可以分割成为abc def ghi.尤其在点分十进制的IP中提取应用较多。strtok()用来将字符串分割成一个个片段。参数s指向欲分割的字符串,参数delim则为分割字符串中包含的所有字符。当strtok()在参数s的字符串中发现参数delim中包涵的分

2015-04-30 13:05:37 494

转载 c++ 字符串流 sstream(常用于格式转换)

使用stringstream对象简化类型转换C++标准库中的提供了比ANSI C的更高级的一些功能,即单纯性、类型安全和可扩展性。在本文中,我将展示怎样使用这些库来实现安全和自动的类型转换。为什么要学习如果你已习惯了风格的转换,也许你首先会问:为什么要花额外的精力来学习基于的类型转换呢?也许对下面一个简单的例子的回顾能够说服你。假设你想用sprintf()函数将一个变量从int

2015-04-30 12:55:18 443

原创 紫薯e5-3uva 10815

Problem B: Andy’s First DictionaryTime limit: 3 secondsAndy, 8, has a dream - he wants to produce his very own dictionary. This is not an easy task for him, as the number of words that he knows is, wel

2015-04-30 12:37:10 336

原创 紫薯e5-2 uva101 the blocks problem

The Blocks Problem Time Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %llu SubmitStatusDescriptionDownload as PDFBackground Many areas of Computer Science use simple, abstract doma

2015-04-30 09:20:00 405

原创 e5-1 uva10474

题 本题注意lower_bound 函数的应用,查找大于或等于x的第一个位置 lower_bound(a,a+n,x)#include <iostream>#include<algorithm>using namespace std; /* run this program using the console pauser or add your own getch, system("pau

2015-04-30 08:19:38 289

转载 selection sort 选择排序

先把代码贴出来,然后按照代码一步一步分析[cpp] view plaincopy#include    void swap(int a[], int x, int y) {      int tmp = a[x];      a[x] = a[y];      a[y] = tmp;  }     

2015-04-29 22:40:46 326

空空如也

空空如也

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

TA关注的人

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