- 博客(19)
- 资源 (8)
- 问答 (2)
- 收藏
- 关注
原创 sklearn中的K-近邻分类使用。
在之前的文章中也介绍了KNN的算法原理,并且完成了两个案例进一步的理解了KNN。这都使用的是自己写的kNN分类器,scikit-learn包在机器学习和数据挖掘中是一个强大的包,其中就包含了许多的算法实现以及实用的功能。而在《Python数据挖掘入门与实践》这本书中,并没有像《机器学习》或者《机器学习实战》中的那样介绍原理或者自己实现某个算法,而是直接使用sklearn(scikit-learn)中
2018-01-28 19:48:11 2807
原创 661. Image Smoother。
Given a 2D integer matrix M representing the gray scale of an image, you need to design a smoother to make the gray scale of each cell becomes the average gray scale (rounding down) of all the 8 surrou
2018-01-27 23:43:02 479
原创 122. Best Time to Buy and Sell Stock II。
Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy one and
2018-01-26 23:20:32 453
原创 287. Find the Duplicate Number。
Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate number, fin
2018-01-26 00:07:04 492
原创 766. Toeplitz Matrix。
A matrix is Toeplitz if every diagonal from top-left to bottom-right has the same element.Now given an M x N matrix, return True if and only if the matrix is Toeplitz.Example 1: Input: matrix = [[1,2
2018-01-25 00:06:21 1090
原创 697. Degree of an Array。
Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements.Your task is to find the smallest possible length of a (co
2018-01-12 20:32:17 491
原创 简单明了的分类算法:OneR。
在之前介绍的kNN算法属于一种分类算法,之后会介绍的决策树也是属于分类算法。分类算法的目的就是根据训练集的特征将新的数据进行预测,当然能够找到特征之间的联系越多那么最后的分类结果也就应该越准确。但是有没有一个比较简单的算法,能够使用极少的特征就能够进行简单的分类呢?那就是OneR算法了。OneR算法介绍。OneR的全称为:One Rule,顾名思义也就是一条规则的意思。也就是说我们最终仅仅根据训练集
2018-01-12 17:25:44 4127 1
原创 565. Array Nesting。
A zero-indexed array A of length N contains all integers from 0 to N-1. Find and return the longest length of set S, where S[i] = {A[i], A[A[i]], A[A[A[i]]], … } subjected to the rule below.Suppose the
2018-01-10 15:35:53 398
原创 674. Longest Continuous Increasing Subsequence。
Given an unsorted array of integers, find the length of longest continuous increasing subsequence (subarray).Example 1: Input: [1,3,5,4,7] Output: 3 Explanation: The longest continuous increasi
2018-01-09 20:30:17 483
原创 268. Missing Number。
Given an array containing n distinct numbers taken from 0, 1, 2, …, n, find the one that is missing from the array.Example 1 Input: [3,0,1] Output: 2 Example 2 Input: [9,6,4,2,3,5,7,0,1] Outp
2018-01-08 21:16:20 431
原创 628. Maximum Product of Three Numbers。
Given an integer array, find three numbers whose product is maximum and output the maximum product.Example 1: Input: [1,2,3] Output: 6 Example 2: Input: [1,2,3,4] Output: 24 给定一个数组,找出三个数产生的乘积
2018-01-08 20:11:59 425
原创 747. Largest Number At Least Twice of Others。
In a given integer array nums, there is always exactly one largest element.Find whether the largest element in the array is at least twice as much as every other number in the array.If it is, return th
2018-01-07 21:12:12 1247
原创 217. Contains Duplicate。
Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every element is
2018-01-07 20:35:17 340
原创 167. Two Sum II - Input array is sorted。
Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers suc
2018-01-06 20:45:58 461
原创 使用k-近邻算法识别手写数字。
在之前的文章中介绍了k-近邻算法的原理知识并且用Python实现了一个分类器,而且完成了一个简单的优化约会网站配对效果的实例。在《机器学习实战》中有关kNN的后一部分内容就是一个手写识别系统,可以识别手写的0-9的数字。下面就基于这一章的内容完成这样一个手写数字识别系统。案例的描述以及流程介绍。既然我们明白了kNN算法是根据计算新数据和样本数据集之间的距离,然后找到距离最小的样本的分类作为新数据的分
2018-01-06 17:37:04 2120
原创 169. Majority Element。
Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element always
2018-01-06 14:41:57 426
原创 238. Product of Array Except Self。
Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i]. Solve it without division and in O(n).
2018-01-05 16:08:55 388
原创 手写数字图片二值化转换为32*32数组。
最近课设外加生病,本来打算在上一篇机器学习使用k-近邻算法改进约会网站的配对效果。就打算写的一直没有时间。按照《机器学习实战》的流程,手写数字识别是kNN中的最后一部分,也是一个比较经典的案例。但是书中是直接使用32*32的二值化(只有1和0)数组进行计算的,书中也并没有讲解如何将手写数字转化为32*32的数组,这方面网上已经有很多资料了,所以只做了一个简单的二值化处理。主要的流程就是将图片打开之后
2018-01-03 09:54:49 8845 5
原创 人生如逆旅,我亦是行人。
时间如流水。2018了。不禁感叹时间真的神奇,无法触及到它的踪迹,却总被它所影响。仿佛一切都会随着时间而改变,总说人年纪大了就喜欢回忆过去的生活,现在看来也不全为假。朋友圈的人们都在过着18岁的狂欢,与其说这是晒自己的过往,不如说是对自己过往的回忆。谁还没个18岁,也正是人与人之间的交集才能够看到他人的18。我总认为相见即是缘,每个人都在走自己的路,这条路通向何方无人知晓,但是人与人的交集也就是路与
2018-01-01 16:53:48 2731
系统分析与设计-小云铺上商城系统
2017-12-26
关于javascript 中的addLoadEvent重复实现函数问题
2016-09-20
c++控制台如何动态显示数字?
2016-04-18
TA创建的收藏夹 TA关注的收藏夹
TA关注的人