- 博客(39)
- 资源 (11)
- 收藏
- 关注
原创 数据挖掘一些概念
基本步骤:1 数据清理2 数据集成3 数据选择4 数据变换5 数据挖掘6 模式评估7 知识表示数据的属性有哪些:1 标称属性:可以说成是事物的名称 例如 头发的颜色:棕色,红色,褐色等2 二元属性:用 0或1 表示,又称布尔属性3 序数属性: 第一,第二,第三,A,B,C,D,等级之类的,序数之间没有明确的差值4 数值属性:有两种 (1).区间标度属...
2022-11-12 23:42:05 317
原创 skipgram模型实现
Word2Vec模型中,主要有Skip-Gram和CBOW两种模型,从直观上理解,Skip-Gram是给定input word来预测上下文。而CBOW是给定上下文,来预测input word。
2022-11-12 23:39:06 346
原创 如下面第一个图的九宫格中,放着 1~8 的数字卡片,还有一个格子空着。与空格子相邻的格子中的卡片可以移动到空格中。
如下面第一个图的九宫格中,放着 1~8 的数字卡片,还有一个格子空着。与空格子相邻的格子中的卡片可以移动到空格中。
2022-11-05 21:36:04 399
原创 a的b次方 mod p
一般的方法,由于b是次方,0<=b<=所以累乘的方法不适用,复杂度太高把拆分成at例如a的7次方,7转换成二进制111,7=(2的0次方)X(2的1次方)X(2的4次方)。所以对每一项进行计算后相乘,时间复杂度减少到logimport java.util.Scanner; public class Main { public static void main(String[] args) { long a=3,b=7,c=4; ...
2021-04-27 12:47:46 379
原创 a乘b后取mod p
对a和b拆解,例如a=7a=例如b=5b=相乘时a x b===只需要对各个项的上标进行计算即可;计算可能会很大,但是n不会特别大,所以可以转变成n个2连乘,每次乘2都mod p就不会溢出。#include"stdio.h"long long power(long long b,long long p);int main(){ long long a=0L; long long b=0L; long long p=0L; l
2021-04-27 11:50:42 298
原创 动态规划——矩阵连乘问题
#include"stdio.h"int a[7][2];//存放要乘的矩阵的行数和列数int b[7][7];//存放矩阵连乘的子问题的代价int c[7][7];//存放子问题的解(分开的下标)int getij(int i,int j)//分解后的子问题,得到子问题的最优解{ int i1=i,j1=j; int q,p,r; int min=0,m1,m2,p1,p2,p3; int k; if(i==j) { b[i.
2021-04-24 15:59:35 84
原创 pyinstaller 打包包含torch,torchvision,pyzbar 不成功解决方案
1 pyinstaller 对与torchvision 只能支持0.3.0以下,好像是这样,不然会出问题,我用的版本是torch1.5.1 cpu 和torchvision0.6.1cpu,打包出现比如这样的错误Traceback (most recent call last): File "Frame.py", line 7, in <module> from detect import detect_main File "<frozen importlib..
2020-07-27 00:32:45 3011
原创 yolov3 训练时如何配置工作环境
运行这个代码要安装一些包numpy == 1.17opencv-python >= 4.1torch >= 1.5matplotlibpycocotoolstqdmpillowtensorboard >= 1.141数据准备1.1 打标签使用labelimg 进行标签的生成,图片不要有中文路径和名称,打完标签时xml文件主要是执行这个软件的命令 python labelimg.py2 将图片放到JEPGimg文件夹下,images里也要一份3 将.
2020-07-19 16:47:15 263
原创 Pyinstaller 打包以及pipenv 虚拟环境应用,以及打包出来程序太大的解决办法
直接在基本环境中使用Pyinstaller将pyinstaller 打包成exe, 打包出来的exe会非常大,最好用pipenv创建一个虚拟环境。在虚拟环境中安装你写的python程序需要的各种包,记得还要安装pyinstaller安装好pipinstaller后pipenv install 创建一个新环境pipenv shell 进入虚拟环境pip install 各种包pip install pyinstaller 这个也要啊。特别注意,如果导入了numpy 这种包,
2020-07-05 17:15:17 780 8
原创 struts2 项目格式
web.xml在webINF文件夹下,不是libHelloworldaction.javapackage cn;public class HelloWorldAction { private String name; public String execute() throws Exception { return "success"; } public String getName(){ return name; } public void setName(...
2020-05-10 08:48:49 134
原创 卷积神经网络——conv2d
# coding: utf-8# In[1]:import tensorflow as tffrom tensorflow import kerasfrom tensorflow.keras import layers,Sequentialfrom tensorflow.examples.tutorials.mnist import input_dataimport matp...
2020-04-19 19:19:10 375
原创 神经网络_tensorflow_keras实现
# coding: utf-8# In[54]:import tensorflow as tffrom tensorflow import kerasfrom tensorflow.keras import layers,Sequentialtf.__version__# In[55]:#第一层3个神经元#第二层两个神经元network=Sequential([...
2020-04-18 11:26:57 315
原创 神经网络_原理实现
import tensorflow as tfimport numpy as npdef relu(temp): return tf.maximum(temp,0)def softmax2(z): exp=tf.exp(z) sum=tf.reduce_sum(tf.exp(z),axis=1,keepdims=True)#在第二个维度上求和,并且保持维度不变 ...
2020-03-31 14:56:13 217
原创 感知机-简单实现
#感知机是二分类的线性模型,其输入是实例的特征向量,输出的是事例的类别,分别是+1和-1,属于判别模型。import numpy as npimport matplotlib.pyplot as pltc0=np.random.normal(6,1,100)c1=np.random.normal(3,1,100)c2=np.random.normal(3...
2020-03-21 22:35:59 129
原创 softmax 手写数字识别
1.导入测试数据from sklearn.datasets import load_digitsimport numpy as npimport matplotlib.pyplot as pltdigits = load_digits()print(digits.data.shape)print(digits.target.shape)print(digits.images.sh...
2020-03-20 19:40:11 1117
原创 softmax 多分类
#生成四个簇import numpy as npimport matplotlib.pyplot as pltc0x=np.random.normal(2,1,100).reshape(100,1)c0y=np.random.normal(2,1,100).reshape(100,1)c1x=np.random.normal(-2,1,100).reshape(100,1)c1y=n...
2020-03-19 21:46:56 177
原创 k-means 代码
from sklearn.cluster import KMeanskmeans = KMeans(n_clusters = 3)kmeans.fit(x)y_kmeans = kmeans.predict(x)plt.scatter(x[:,0], x[:,1], c = y_kmeans, cmap='Dark2', s=50, alpha=0.5, marker='x')cen...
2020-03-19 14:07:33 79
原创 梯度下降,小批量随机梯度下降
1 梯度下降import numpy as npimport matplotlib.pyplot as pltx=np.array(range(0,50))np.random.seed(1)y=6*xlabel_y=y+np.random.random(50)*10x=x.reshape(50,1)label_y=label_y.reshape(50,1)train_data...
2020-03-19 14:06:54 63
原创 sklearn 数据预处理
数据可能是高纬度的,资料标准化后会使得每个特征中的数值平均变为0(将每个特征的值都减掉原始资料中该特征的平均),标准差变为1StandardScaler计算训练集的平均值和标准差,以便测试数据及使用相同的变换。 变换后各维特征有0均值,单位方差,也叫z-score规范化(零均值规范化),计算方式是将特征值减去均值,除以标准差。所有数减去其平均值的平方和,所得结果除以该组数...
2020-03-19 14:06:26 99
原创 逻辑回归模型
生成数据import numpy as npimport matplotlib.pyplot as pltc0=np.random.normal(6,1,100)c1=np.random.normal(3,1,100)c2=np.random.normal(3,1,100)c3=np.random.normal(6,1,100)c0y=np.zeros(100)c1y=np....
2020-03-17 23:27:21 121
原创 Skclearn 随机生成测试样本——聚类样本
from sklearn.datasets import make_blobsfrom matplotlib import pyplotdata,label = make_blobs(n_samples=1000,n_features=2,centers=5)# 绘制样本显示pyplot.scatter(data[:,0],data[:,1],c=label)pyplot.sho...
2020-03-15 14:38:30 222
原创 SKlearn 随机生成测试样本——分类样本
from sklearn.datasets.samples_generator import make_classificationX, y = make_classification(n_samples=200, n_features=4, n_informative=2, n_redundant=2, n_classes=2, n_clusters_per_class=2, sc...
2020-03-15 14:35:55 777
原创 SKlearn-KNN
1 获得数据from sklearn import datasetsiris=datasets.load_iris()iris_x=iris.datairis_y=iris.target2 处理数据,数据分割成测试集和训练集from sklearn.model_selection import train_test_splitX_train,X_test,y_train,y...
2020-03-15 10:33:17 216
原创 Sklearn k-means
from sklearn.cluster import KMeanskmeans = KMeans(n_clusters = 3)kmeans.fit(x)y_kmeans = kmeans.predict(x)plt.scatter(x[:,0], x[:,1], c = y_kmeans, cmap=‘Dark2’, s=50, alpha=0.5, marker=‘x’)centr...
2020-03-11 19:27:35 212
原创 matplotlib 坐标轴区间设置,网格显示,颜色表,图标表
坐标轴区间>>> import matplotlib.pyplot as plt >>> x=np.arange(-5,5,0.01) >>> y=x**3 >>> plt.axis([-6,6,-10,10]) [-6, 6, -10, 10] >>> plt.plot(x,y) ...
2020-03-06 23:08:43 948
原创 配置tensorflow
安装tensorflow安装环境pip install tensorflow=2.0.0如果不行,更换镜像地址conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/conda config --add channels https://mirrors.tuna.tsi...
2020-03-03 19:33:07 66
原创 ubuntu jupyter 配置 后台运行,和结束,nohup 后台运行 curl -X
jupyter 可以安装Anaconda一起安装如果要远程登录的话要配置文件step1生成密钥jupyter notebook --generate-config打开python输入from notebook.auth import passwdpasswd()会得到一个密钥,复制它修改文件jupyter_notebook_config.pyc.No...
2020-02-04 01:27:36 2072
原创 ubuntu搭建简单http代理服务器 TinyProxy
step1安装tinyproxy包sudo apt-get updatesudo apt-get install tinyproxy配置文件在 /etc/tinyproxy.conf还有可能在/etc/tinyproxy/tinyproxy.conf找一找Port 8888 #预设是8888 Port,你可以更改Allow 127.0.0.1 #将127.0.0.1...
2020-02-04 01:01:12 5843
原创 拉普拉斯矩阵——复杂链路预测
L=D-AA是一个图的矩阵表示A=[[0,1,0,0,1,0],[1,0,1,0,1,0],[0,1,0,1,0,0],[0,0,1,0,1,1],[1,1,0,1,0,0],[0,0,0,1,0,0]]D是矩阵每个节点的度[[2. 0. 0. 0. 0. 0.][0. 3. 0. 0. 0. 0.][0. 0. 2. 0. 0. 0.][0. 0. 0. 3. 0. 0....
2020-02-04 00:44:43 403
原创 机器学习常用算法归纳小记
概念分类:监督学习,利用一组已知类别的样本调整分类器的参数,使其达到所要求性能的过程,也称为监督训练或有教师学习 也就是线性回归得到直线的到每个点的代价的最小值无监督学习我们不知道数据集中数据、特征之间的关系,而是要根据聚类或一定的模型得到数据之间的关系就是分类问题,一些数据根据特征分类...
2020-02-03 00:22:55 87
原创 合作者推荐第一步 k-means 聚类
第一步:得到两个作者的数据,发表的论文数和论文被引用的数量的和# -*- coding: utf-8 -*-"""Created on Thu Sep 5 10:40:57 2019@author: Administrator"""import jsonfo=open("D:\\mag_authors_2\\mag_authors_10.txt",'r+')fi=open('...
2020-02-03 00:22:13 136
原创 监督学习
训练集 Training setm训练的数量x输入特征 向量y预测值xi->yi预测函数h(x)=yhO(x)=O0+O1x模型名称:线性回归如何选择O0和O1来适应预测函数h从x和y的样本,使得O0,O1更接近样本数据所以求和(h(xi)-yi)^2最小值最小求最小的代价函数,与直线拟合先看一个特殊的只有O1O1取不同的值代价函数的变化代价函数但...
2020-02-03 00:21:56 132
原创 tar,pstree进程信息,线程挂起,top,合并文件,统计单词,date,cp显示覆盖信息
tartar -cf xxx.tar file1 file2 打包file1 file2 到tartar -tvf 查看压缩包里文件tar -xf xxx.tar 解压如果要解压到特定文件夹tar -xf xxx.tar -C 路径tar -rvf file.tar.bz2 file2.txt添加文件到压缩包里tar -xvf file.tar.bz2 file2.txt解压特...
2020-02-03 00:07:52 136
原创 控制台切换,编辑vim,转码window-liunx处理换行不一样,用户切换
tty控制台终端tty1-tty6tty1既是图形界面(默认)图形界面切换到字符界面终端:ctrl + shift + alt + F2~F6字符界面切花到图形界面终端:alt + F1pts虚拟终端ctrl + alt + t 打开新终端查看系统和BIOS硬件时间:指的是bios时间shutdown -h now #马上关机shutdown -h +10 #10分钟后关...
2020-02-02 23:52:31 115
原创 新浪微博后续json 数据分析和抓取
微博数据抓取下拉由json数据返回的动态数据因为下拉的数据要不同的数据才能返回不同页码的数据,懒得分析参数了,url 的参数是由首页数据的最后一个微博的参数决定的,没有整合到一起,这里只是做个示范,假定数据给定的情况,后续要加工成一体的。#!/usr/bin/python# -*- coding: UTF-8 -*-#获取 新浪微薄 下拉后得到的微博信息 返回json数据from...
2019-08-30 19:05:35 246
原创 新浪微博自己的首页数据抓取(微博列表)
新浪微博自己的首页数据抓取(微博列表)header 参数需要自己从浏览器或者抓包获取# -*- coding: utf-8 -*-#获取第一页的信息,这是第一部分,由于后续的微博列表是动态json数据加载的,所以要有所不同"""@author: Administrator"""from bs4 import BeautifulSoupimport reimport reques...
2019-08-30 18:58:36 425 1
原创 python numpy 数组与矩阵运算 简单函数功能
import numpy as np数组基本生成和使用方法单位矩阵 eye(m,n) 会生成一个单位矩阵 --对角线为1 其余为0narray(object,args.....) 根据给的object 生成相应的数组 若使用 参数 ndim=n ,n为要生成数组的维度。数组为n维数组参数dtype = [ 点击查看数据类型] 则该数组为该类型数组# int8, int16, ...
2019-08-30 18:34:17 178
labelImg.rar
2020-07-19
yolov3原版.rar
2020-07-19
逻辑回归模型,python代码
2020-03-21
softmax多分类.rar
2020-03-21
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人