自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 人工神经网络手写数字

import sklearnimport matplotlib.pyplot as pltfrom tensorflow import kerasfrom sklearn.preprocessing import StandardScalerimport numpy as npimport pandas as pdtrain_data=pd.read_excel(r"C:\Users\Desktop\train.xlsx")test_data=pd.read_excel(r"C:\Users\

2020-07-05 12:13:45 1791

原创 海明码

#include<bits/stdc++.h>using namespace std;int d=0;char * encodinghamming(char * code){ char* encode; while(pow(2,d)<strlen(code)+d+1) d++; cout<<"添加的校验位为"<<d<<"位"<<endl; int t=0;int s=0; for

2020-07-03 09:39:06 247

原创 kmeans聚类

import randomimport pandas as pdimport numpy as npimport matplotlib.pyplot as plt# 计算欧拉距离def calcDis(dataSet, centroids, k): clalist=[] for data in dataSet: diff = np.tile(data, (k, 1)) - centroids #相减 (np.tile(a,(2,1))就是把a先沿x轴复制1倍

2020-06-19 11:26:31 401 1

原创 sql server基本语句

create database SCH_ID;use SCH_IDGocreate table S(sno char(9) primary key,sname char(20),sex char(2),age smallint,dno char(4));use SCH_IDGoinsert into S values('s1','小明','男',20,'D1');inse...

2020-04-17 23:25:49 329 1

原创 python---爬虫通用框架

import requestsdef getHTMLText(url): try: r=requests.get(url,timeout=30) r.raise_for_status() r.encoding=r.apparent_encoding return r.text except: retu...

2020-01-03 10:39:17 153

原创 python连接数据库

31页from bs4 import BeautifulSoupfrom collections import Counterfrom nltk.corpus import stopwordsfrom nltk import LancasterStemmerimport urllib.requestURL=input("Enter a website")with urllib.req...

2020-01-03 10:38:34 107

原创 python---生成alco

import pandas as pdimport numpy as npFilename = r'F:\信科工作文件\课件\数据科学入门课件\alco_2.xlsx'df = pd.DataFrame(pd.read_excel(Filename))#读入第一列数据——Statedf_index=df['State']#去掉州列表中的重复项df_index = df_index...

2020-01-03 10:37:35 138 1

原创 python---读取alco2009

# -*- coding: utf-8 -*-"""Created on Wed Mar 27 19:44:59 2019@author: Emma"""#简单导入代码import pandas as pdimport numpy as npFilename = r'F:\信科工作文件\课件\数据科学入门课件\alco2009.xlsx'alco2009 = pd.DataF...

2020-01-03 10:36:44 113

原创 python boders数据读取

import pandas as pdimport numpy as npFilename = r'F:\数据科学入门课件\territories.xlsx'df = pd.DataFrame(pd.read_excel(Filename))Filename = r'F:\数据科学入门课件\area_length_2.xlsx'df2 = pd.DataFrame(pd.read_exc...

2020-01-03 10:35:51 146

原创 分支限界----最优装载

#include<iostream>#include<bits/stdc++.h>using namespace std;int MaxLoading(int w[],int c,int n){ queue<int>Q; int bestw=0; int i=1; int ew=0; int r=0; f...

2019-12-30 13:19:53 263

原创 分支限界---单源最短路径

#分支限界---单源最短路径#include<iostream>#include<bits/stdc++.h>using namespace std;#define inf 0x3f3f3fint c[100][100];int dist[100];int prev[100];int n;struct Vex{ int i; int le...

2019-12-17 16:29:11 748

原创 回溯---旅行售货员

#include<iostream>#include<bits/stdc++.h>using namespace std;#define inf 0x3f3f3fint bestx[1000];int x[1000];int cc=0;int bestc=inf;int a[100][100];int n;void swap(int &a,in...

2019-12-14 21:41:58 93

原创 数值分析---改进的欧拉公式

#include<iostream>#include<bits/stdc++.h>using namespace std;float f(float x,float y){ return y-2*x/y;}void Euler(float x,float y,int N){ float yc,yp; float h=0.1; ...

2019-12-14 00:28:31 2106

原创 数值分析---牛顿插值

#include<iostream>#include<bits/stdc++.h>using namespace std;float m[100][100];float Newton(float x[],float y[],int n,float t){ int r=1; memset(m,0.0,sizeof(m)); float va...

2019-12-14 00:27:32 161

原创 数值分析--拉格朗日插值

#include<iostream>#include<bits/stdc++.h>using namespace std;float lagrange(float x[],float y[],int n,float t){ float value=0.0; float temp1,temp2; for(int i=0; i<n; i+...

2019-12-14 00:26:22 257

原创 贪心---哈夫曼编码---优先队列

#include<iostream>#include<queue>#include<bits/stdc++.h>using namespace std;struct Element{ int parent; int lchild; int rchild; int weight; int num; char...

2019-12-05 22:05:33 173

原创 贪心---克鲁斯卡尔算法--最小生成树

#最小生成树---克鲁斯卡尔算法#include <iostream>#include<bits/stdc++.h>#include <queue>using namespace std;struct Edge{ int x, y; int weight; bool operator<(const Edge &...

2019-12-05 15:53:38 158

原创 贪心--装载问题

#最优装载--贪心#include<iostream>#include<bits/stdc++.h>using namespace std;int sum=0;struct things{ int w; int num;} thing[1000];bool cmp(things a,things b){ if (a.w<b....

2019-12-05 00:25:29 89

原创 贪心--背包问题

#背包问题#include<iostream>#include<bits/stdc++.h>using namespace std;struct Bag{ double v; double w; double value; int num;} bag[1000];int sum=0;bool cmp(Bag a,Bag b)...

2019-12-05 00:23:27 141

原创 贪心--活动安排

#贪心算法--活动安排#include<iostream>#include <algorithm>#include<bits/stdc++.h>using namespace std;struct activity{ int s; int f; int num;} act[1000];bool cmp(activity ...

2019-12-05 00:22:48 131

原创 最优装载问题

迭代#include<iostream>using namespace std;int loading(int w[],int n,int c,int bestx[]){ int x[n]; int cw=0; int bestw=0; int r=0; for(int i=1;i<=n;i++) r=r+w[i]...

2019-12-04 19:53:13 120

原创 n后问题

#n后问题—递归#include <iostream>#include<bits/stdc++.h>using namespace std;int x[1000];int sum;int n;bool place(int k){ for(int i=1; i<k; i++) { if(x[i]==x[k]||(abs(i...

2019-12-04 09:38:04 148

原创 动态规划---0-1背包

#0-1背包#include <iostream>#include<bits/stdc++.h>using namespace std;int m[100][100];int max(int a,int b){ if(a>b) return a; else return b;}void knapsack(...

2019-11-28 10:40:28 81

原创 动态规划---矩阵连乘

#矩阵连乘#include <iostream>#include<bits/stdc++.h>using namespace std;int m[100][100];int s[100][100];void Matrix(int n,int p[]){ memset(m,0,sizeof(m)); memset(s,0,sizeof(s));...

2019-11-28 10:37:40 74

原创 贪心算法---最小生成树prim算法

#最小生成树 prim#include #include<bits/stdc++.h>using namespace std;int c[100][100];#define inf 0x3f3f3f3fvoid shortest(int n,int v0){int closest[n];int lowcost[n];bool s[n];for(int i=1; i...

2019-11-27 13:13:10 315

原创 贪心算法---单源最短路径迪杰斯特拉算法

#贪心算法单源最短路径迪杰斯特拉#include #include<bits/stdc++.h>using namespace std;int c[100][100];#define inf 0x3f3f3f3fvoid path(int n,int v,int dist[],int prev[]){bool s[n];int min=inf;for(int i=1...

2019-11-27 13:12:22 167

原创 归并,快排,插入排序,二分查找

归并排序#include using namespace std;void Merge(int a[],int b[],int l,int m,int r){int i=l,j=m+1,k=l;while((i<=m)&&(j<=r)){if(a[i]<=a[j])b[k++]=a[i++];elseb[k++]=a[j++];}if(i...

2019-11-19 23:50:12 156

原创 动态规划---最长公共子序列

#最长公共子序列#include #include<bits/stdc++.h>using namespace std;int c[100][100];int b[100][100];void Length(string x,string y,int m,int n){memset(c,0,sizeof©);memset(b,0,sizeof(b));for(int...

2019-11-19 23:47:27 92

原创 课后题

第二章1.import numpy as nparr = np.random.rand(10,5)arr2.import numpy as npmatr1 = np.mat(“2 3; 4 5”)matr1matr2 = np.mat(“5 6; 7 8”)matr2matr1 * matr2第三章1.import numpy as npimport matplot...

2019-11-04 18:41:54 1896 1

原创 第九章

-- coding: utf-8 --“”"Created on Mon Oct 21 12:12:38 2019@author: Dell“”"import pandas as pdimport numpy as npdata=pd.read_excel(“C:\data\original_data.xls”)print(data.shape)data.drop(labels=...

2019-11-04 18:41:17 398 1

原创 第八章

#例题import pandas as pdimport numpy as npdata=pd.read_csv(“C:\data\data8.csv”,encoding=‘gbk’)np.round(data.corr(method=‘pearson’),2)from sklearn.linear_model import Lassolasso=Lasso(1000).fit(dat...

2019-11-04 18:40:29 1145 6

原创 第七章

#课本例题import numpy as npimport pandas as pdairline_data=pd.read_csv(“C:\data\air_data.csv”,encoding=‘gb18030’)print(airline_data.shape)exp1=airline_data[‘SUM_YR_1’].notnull()exp2=airline_data[‘SU...

2019-11-04 18:39:32 440

原创 sklearn预处理,训练集测试集,聚类分类回归

#load_breast_cancerfrom sklearn.datasets import load_breast_cancercancer=load_breast_cancer()len(cancer)type(cancer)cancer_data=cancer[‘data’]cancer_target=cancer[‘target’]cancer_names=cancer[‘...

2019-11-04 18:37:43 764

原创 pandas简单操作

#实训1from scipy.interpolate import lagrangeimport pandas as pddata=pd.read_csv(“C:\data\missing_data.csv”,encoding=‘gbk’,header=None)def ployinterp_column(s,n,k=5):y=s[list(range(n-k,n))+list(rang...

2019-11-04 18:35:33 143

原创 sklearn聚类分类回归

#load_breast_cancerfrom sklearn.datasets import load_breast_cancercancer=load_breast_cancer()len(cancer)type(cancer)cancer_data=cancer[‘data’]cancer_target=cancer[‘target’]cancer_names=cancer[‘...

2019-09-26 11:25:18 403

原创 python--matplotlib箱线图折线图散点图直方图

#3-1import numpy as npimport matplotlib.pyplot as pltdata=np.arange(0,1.1,0.01)plt.title(“lines”)plt.xlabel(‘x’)plt.ylabel(‘y’)plt.xlim((0,1))plt.ylim((0,1))plt.xticks([0,0.2,0.4,0.6,0.8,1])...

2019-09-02 21:02:26 1057 1

原创 python————matplotlib

import numpy as npimport matplotlib.pyplot as pltdf=np.load(“C:\Users\Dell\Desktop\populations.npz”)def getKeys(df):ks=[]for i in df.keys():ks.append(i)return kskeys = getKeys(df)values = df[...

2019-09-01 19:47:52 214

空空如也

空空如也

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

TA关注的人

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