自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 python实现两层神经网络识别手写数字体(2)

博客等结课再开放。。。# coding: utf-8from collections import OrderedDicttry: import urllib.requestexcept ImportError: raise ImportError('You should use Python 3.x')import numpy as npimport mnistdef softmax(x): if x.ndim == 2: x = x.T

2021-05-27 21:12:01 218

原创 python实现两层神经网络识别手写数字体

第一部分是下载数据第二部分常用函数第三部分是神经网络类第四部分主函数# coding: utf-8try: import urllib.requestexcept ImportError: raise ImportError('You should use Python 3.x')import os.pathimport gzipimport pickleimport osimport mathimport numpy as np# 以下部分为下载数据集url_

2021-05-13 20:26:51 289

原创 09.维纳滤波

#include <bits/stdc++.h>#include <opencv2/opencv.hpp>using namespace cv;using namespace std;void calcPSF(Mat& outputImg, Size filterSize, int len, double theta);void fftshift(const Mat& inputImg, Mat& outputImg);void filter2

2021-04-07 16:46:14 337

原创 08.DCT图像压缩

#include<bits/stdc++.h>#include<opencv2/opencv.hpp>using namespace cv;using namespace std;const double pi = 3.1415926;int width, height, channels;double dct1[80][80][10][10];double result[80][80][10][10];double result2[80][80][10][10];

2021-03-20 15:52:57 596 1

原创 07.K-means聚类

#include<bits/stdc++.h>#define ll long longusing namespace std;const double inf=1.0*(0x3f3f3f3f);const double eps=1e-6;double solve(double x[][5],int m,int K,int n)//训练样本数 簇数量 样本维数(默认m>K { double mu[10][5]; for(int i=1;i<=K;i++)//多次运行

2021-03-11 14:40:40 68

原创 06.神经网络反向传播+梯度下降分类

模型不太对。。。是一次失败的尝试,后面再改吧。#include<bits/stdc++.h>#define ll long longusing namespace std;const double eps=1e-4;//除去a0每层分别有2 4 4 2个节点 double g(double x)//激活函数 { return 1.0/(1.0+exp(-x)); } double theta[20][20][20];double delta[20][20];doubl

2021-03-06 17:12:47 76

原创 05.神经网络简单异或实例(固定参数)

#include<bits/stdc++.h>#define ll long longusing namespace std;double h(double x)//激活函数 { return 1.0/(1.0+exp(-x)); } double pand(double * x)//与神经元 { x[0]=1.0; double ans=-30.0*x[0]+20.0*x[1]+20.0*x[2]; return h(ans);}double pnxand

2021-03-06 10:02:53 200

原创 04.正则化线性回归/Logistic回归

线性回归的正则化#include<bits/stdc++.h>#define ll long longusing namespace std;const double eps=1e-8;double * solve(double x[][10],double y[],int m,int n)//输入数组x,y训练集大小m,特征数量n{ static double theta[10]; double lambda=1.0; double alpha=0.01; do

2021-03-05 20:02:03 148

原创 03.梯度下降解Logistic回归

虽然是不同的算法,但是最后结果的形式和多元线性回归几乎一样,只要稍微改改就好了正规方程法解线性回归只涉及简单的矩阵运算即使要使用也不会有太多改动所以不会写#include<bits/stdc++.h>#include<math.h>#define ll long longusing namespace std;const double eps=1e-10;double * solve(double x[][10],double y[],int m,int n)//输入

2021-03-05 14:02:18 121

原创 02.梯度下降解多元线性回归

每次迭代时间复杂度O(m*n)#include<bits/stdc++.h>#define ll long longusing namespace std;const double eps=1e-10;double * solve(double x[][10],double y[],int m,int n)//输入数组x,y训练集大小m,特征数量n{ static double theta[10]; double alpha=0.01; double tmp[10];

2021-03-04 18:08:46 197 2

原创 01.梯度下降解单变量线性回归

之前事情太多一直没写博客,上学期十二月份打完区域赛就耻辱退役了。。。这段时间会一边学习一边用C++实现机器学习和图像识别的算法,希望代码没事。。。#include<bits/stdc++.h>#define ll long longusing namespace std;const double eps=1e-10;//假设函数为y=theta[1]*x+theta[0]//Batch梯度下降法求解线性回归 double * solve(double x[],double y[],

2021-03-04 15:21:11 216 1

原创 java-日历记事本

java-日历记事本功能还不完善,能毕业就行.jpgpackage com.company;import java.awt.*;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.io.BufferedReader;import java.io.File;import java.io.FileNotFoundException;import java.io.FileReade

2020-07-27 10:42:42 3005 3

原创 cf659 div2 B

题目链接:http://codeforces.com/contest/1384/problem/B2设t=0时潮水在最低点,,没有限制的时候限制区间为[-k,k],设lim=l-d[i],如果lim>=k则可以重置限制区间(因为在这个点可以呆很久,一周期的任意时间点都不会溺水),否则当前限制区间取原先的限制区间和[-lim,lim]的交集,到下一节点时限制区间往右平移1即可,由于每次最多平移1个单位,所以限制区间不会出现多个,只会存在一个连续的区间,区间长度大于等于零即可满足条件到达对岸。#in

2020-07-25 09:18:33 174

原创 Codeforces Round #630 (Div. 2) D. Walk on Matrix

题目链接有趣的构造题,就是要构造一个矩阵,使得dp出来的结果为0,实际最大值为k,也就是终点的值为k但是终点左边和上边的点dp结果为一个比k大的数且为2n次方,这样最终dp出来的结果就是0,由于k<=100000我们取这个数字为217;直接上代码8.#include<bits/stdc++.h>#define ll long long#define inf 0x3f3f3...

2020-04-04 14:27:57 134

原创 Codeforces Round #630 (Div. 2) E. Height All the Same

题目链接题目大意:mn个格子,每个格子上初始摆放有ai,j个方块,L≤ai,j≤R for all 1≤i≤n, 1≤j≤m;有两种操作,第一种在两个相邻的格子上各放一块,第二种是在一个格子里放两块,问有多少种初始的摆放方式使得在若干次操作后所有格子上方块数一样。假设要使所有格子上方块数为x,需要填充的数量为偶数,那么一定可以用合法的操作将所有格子上的方块数全部变为x+2。所以,如果mn为奇...

2020-04-04 14:05:30 98

原创 F - Tree Intersection

Bobo has a tree with n vertices numbered by 1,2,…,n and (n-1) edges. The i-th vertex has color c i, and the i-th edge connects vertices a i and b i.Let C(x,y) denotes the set of colors in subtree roo...

2020-01-11 16:42:53 98

原创 E - Dominant Indices

You are given a rooted undirected tree consisting of n vertices. Vertex 1 is the root.Let’s denote a depth array of vertex x as an infinite sequence [dx,0,dx,1,dx,2,…], where dx,i is the number of ve...

2020-01-11 09:46:28 184

原创 D - Lomsat gelral

You are given a rooted tree with root in vertex 1. Each vertex is coloured in some colour.Let’s call colour c dominating in the subtree of vertex v if there are no other colours that appear in the su...

2020-01-11 07:58:56 234

原创 C - 数据分割

小w来到百度之星的赛场上,准备开始实现一个程序自动分析系统。这个程序接受一些形如xi=xj 或 xi≠xj 的相等/不等约束条件作为输入,判定是否可以通过给每个 w 赋适当的值,来满足这些条件。输入包含多组数据。然而粗心的小w不幸地把每组数据之间的分隔符删掉了。他只知道每组数据都是不可满足的,且若把每组数据的最后一个约束条件去掉,则该组数据是可满足的。请帮助他恢复这些分隔符。Input...

2020-01-11 07:51:38 355 1

原创 B - Monkey King

Once in a forest, there lived N aggressive monkeys. At the beginning, they each does things in its own way and none of them knows each other. But monkeys can’t avoid quarrelling, and it only happens b...

2020-01-10 20:51:19 108

原创 启发合并+左偏树

A - dispatching在一个忍者的帮派里,一些忍者们被选中派遣给顾客,然后依据自己的工作获取报偿。在这个帮派里,有一名忍者被称之为 Master。除了 Master以外,每名忍者都有且仅有一个上级。为保密,同时增强忍者们的领导力,所有与他们工作相关的指令总是由上级发送给他的直接下属,而不允许通过其他的方式发送。现在你要招募一批忍者,并把它们派遣给顾客。你需要为每个被派遣的忍者 支付一定的...

2020-01-10 20:43:57 107

原创 莫队补题

An array of positive integers a1, a2, …, an is given. Let us consider its arbitrary subarray al, al + 1…, ar, where 1 ≤ l ≤ r ≤ n. For every positive integer s denote by Ks the number of occurrences o...

2019-08-20 09:56:57 185

原创 19暑假拉格朗日插值A

There are well-known formulas: , , . Also mathematicians found similar formulas for higher degrees.Find the value of the sum modulo 109 + 7 (so you should find the remainder after dividing the answe...

2019-08-19 15:24:21 89

原创 19暑假连通分量H

Byteotia城市有n个 towns m条双向roads. 每条 road 连接 两个不同的 towns ,没有重复的road. 所有towns连通。Input输入n<=100000 m<=500000及m条边Output输出n个数,代表如果把第i个点去掉,将有多少对点不能互通。Sample Input5 51 22 31 33 44 5Sample Outp...

2019-08-16 16:06:14 119

原创 19暑假连通分量G

A number of schools are connected to a computer network. Agreements have been developed among those schools: each school maintains a list of schools to which it distributes software (the “receiving sc...

2019-08-16 16:00:01 72

原创 19暑假连通分量D

Bessie’s been appointed the new watch-cow for the farm. Every night, it’s her job to walk across the farm and make sure that no evildoers are doing any evil. She begins at the barn, makes her patrol, ...

2019-08-16 15:56:49 86

原创 19暑假连通分量C

A Telephone Line Company (TLC) is establishing a new telephone cable network. They are connecting several places numbered by integers from 1 to N . No two places have the same number. The lines are bi...

2019-08-16 15:55:53 79

原创 19暑假连通分量B

Every cow’s dream is to become the most popular cow in the herd. In a herd of N (1 <= N <= 10,000) cows, you are given up to M (1 <= M <= 50,000) ordered pairs of the form (A, B) that tell...

2019-08-16 15:53:43 66

原创 19暑假连通分量A

There are N bombs needing exploding.Each bomb has three attributes: exploding radius ri, position (xi,yi) and lighting-cost ci which means you need to pay ci cost making it explode.If a un-lighting ...

2019-08-16 15:50:43 83

原创 cf#579 F2

http://codeforces.com/contest/1203/problem/F2F2. Complete the Projects (hard version)time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe onl...

2019-08-14 19:58:23 139

原创 cf#579 D

http://codeforces.com/contest/1203/problem/D2D2. Remove the Substring (hard version)time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe only...

2019-08-14 10:44:13 129

原创 cf#579 F1

http://codeforces.com/contest/1203/problem/F1F1. Complete the Projects (easy version)time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe onl...

2019-08-14 10:05:13 443 3

原创 cf#579 E

http://codeforces.com/contest/1203/problem/EE. Boxerstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n boxers, the weight of the i...

2019-08-14 09:44:49 350 2

原创 cf#579 C

http://codeforces.com/contest/1203/problem/CC. Common Divisorstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array a consi...

2019-08-14 09:41:29 328

原创 cf#579 B

http://codeforces.com/contest/1203/problem/BB. Equal Rectanglestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given 4n sticks, the ...

2019-08-14 09:37:09 212

原创 cf#579A

http://codeforces.com/contest/1203/problem/AA. Circle of Studentstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n students standi...

2019-08-14 09:29:18 165

原创 19暑假树链剖分D

wls 有三棵树,树上每个节点都有一个值 ai,现在有 2 种操作:将一条链上的所有节点的值开根号向下取整;求一条链上值的和;链的定义是两点之间的最短路。Input第一行两个数 n, q 分别代表树上点的数量和操作数量。第二行 n 个整数,第 i 个数代表第 i 个点的值 ai。接下来 n − 1 行, 每行两个整数 u, v 代表 u,v 之间有一条边。数据保证点两两联通。接下...

2019-08-13 09:32:35 112

原创 19暑假dp优化

L公司有N个工厂,由高到底分布在一座山上。如图所示,工厂1在山顶,工厂N在山脚。由于这座山处于高原内陆地区(干燥少雨),L公司一般把产品直接堆放在露天,以节省费用。突然有一天,L公司的总裁L先生接到气象部门的电话,被告知三天之后将有一场暴雨,于是L先生决定紧急在某些工厂建立一些仓库以免产品被淋坏。由于地形的不同,在不同工厂建立仓库的费用可能是不同的。第i个工厂目前已有成品Pi件,在第i个工厂...

2019-08-10 15:33:16 95

原创 cf ed#70 D

The subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements.You are given an integer n.You have to find a s...

2019-08-10 15:23:19 159

原创 19暑假dp优化A

A festival will be held in a town’s main street. There are n sections in the main street. The sections are numbered 1 through n from left to right. The distance between each adjacent sections is 1.In...

2019-08-09 17:19:11 154

空空如也

空空如也

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

TA关注的人

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