自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

闲庭信步

数据分析、产品学习笔记

  • 博客(295)
  • 资源 (2)
  • 收藏
  • 关注

原创 6. N 字形变换 @python @java

字符串处理,用方向变量来标记方向。

2023-08-07 19:42:38 142

原创 5. 最长回文子串 @python @java

遍历字符串在每个下标处尝试构建两种回文字符串(aa或者aba)。取最长的字符串长度。

2023-08-04 15:39:37 120

原创 3. 无重复字符的最长子串 @python @java

双指针,右指针遍历,如果右指针遇到重复字母,那么将左指针移至该字符索引的下一个。

2023-08-04 15:23:36 123

原创 2. 两数相加 @python @java

模拟法,从左向右相加,如果和超过10就进位。

2023-08-04 15:12:14 73

原创 1. 两数之和 @python @java

用哈希表储存数字和下标。

2023-08-04 14:41:57 29

原创 Kaggle手写数字识别

算法:支持向量机降维:主成分分析。

2023-04-26 14:26:47 169

原创 测试与实验设计

A/B测试:一种受控实验,经常在网站上进行,也可以在其他环境中进行。要测试的是对网站做出某种改变后的效果,并和改变以前进行对比。我们使用T检验和p值来衡量实验效果是否显著。

2023-04-25 20:03:37 58

原创 K折交叉验证

K折交叉验证可以防止过拟合。

2023-04-25 17:26:47 136

原创 数据降维-主成分分析

维度灾难:当数据有很多维度时,会引发一系列的问题。它会导致预测的结果不准确,并且很难进行可视化。主成分分析:PCA就是在高维空间中选择能够保持数据中大多数方差的超平面,然后将数据投射到这些高维平面上,从而得到一个低维的数据空间。PCA是一种非常有用的工具,可用于压缩、特征提取、面部识别。

2023-04-24 17:15:47 109

原创 推荐系统-基于项目的协同过滤

推荐系统使用基于项目的协同过滤,优点是:1)人是善变的,但项目不随着时间发生变化。2)推荐的项目比人少得多,可以节省大量的计算能力,可以使用更加复杂的算法。思路:建立基于项目的协同过滤系统,即实现“看了这部电影的人也看了…”和“对这部电影高度评价的人也高度评价了…”这些功能,即建立电影之间的联系。

2023-04-24 12:59:34 350

原创 协同过滤-找出电影的相似度

找出电影之间的相关度,相关度高的电影,认为它是相似电影。相关度的衡量指标:pearson相关系数:pearson相关系数衡量的是线性相关关系。若r=0,只能说x与y之间无线性相关关系,不能说无相关关系。相关系数的绝对值越大,相关性越强:相关系数越接近于1或-1,相关度越强,相关系数越接近于0,相关度越弱。spearman相关系数:它是衡量两个变量的依赖性的 非参数 指标。它利用单调方程评价两个统计变量的相关性。如果数据中没有重复值, 并且当两个变量完全单调相关时,斯皮尔曼相关系数则为+1或−1。

2023-04-24 10:29:43 317

原创 使用支持向量机对人员聚类

在数学上,支持向量机能够找出更高维的支持向量,由支持向量定义更高维的平面来将数据划分为不同的簇。通过不同的核函数可以得到不同的结果。

2023-04-23 16:37:22 162

原创 决策树-随机森林

在决策树流程图的每个步骤中,都要找到这样一个属性,它对数据的划分使得下一步中的熵是最小的。我们会得到两个分类,在例子中是录用和不录用,我们要在这个步骤中确定一个属性,使得下一步的熵最小。它是一种贪婪算法,在生成树的每个步骤中都要给选择使熵最小的属性。

2023-04-23 11:32:24 1018 2

原创 无监督学习-K均值聚类

k均值聚类是机器学习中一种非常常用的技术,简单来说,k均值聚类就是将数据分成k个组,根据数据点距离哪个组的中心点最近而决定。

2023-04-23 09:17:15 648

原创 朴素贝叶斯实现垃圾邮件分类器

贝叶斯定理由英国数学家贝叶斯 ( Thomas Bayes 1702-1761 ) 发展,用来描述两个条件概率之间的关系,比如 P(A|B) 和 P(B|A)。按照乘法法则,可以立刻导出:P(A∩B) = P(A)*P(B|A)=P(B)*P(A|B)。如上公式也可变形为:P(A|B)=P(B|A)*P(A)/P(B)。使用朴素贝叶斯对垃圾邮件进行分类, 假定各个单词之间没有联系。只是独立地检查邮件中的每个单词,然后将每个单词对确定是否为垃圾邮件的贡献组合起来。

2023-04-21 16:50:33 310

原创 监督学习-多项式回归-python3

多元回归使用R²衡量整体的拟合度。R²的值越接近1,说明回归直线对观测值的拟合程度越好。拟合度r2计算公式:R2=ESS/TSS=1-RSS/TSS。

2023-04-21 13:23:31 415

原创 使用KNN预测电影评分-python3

在散点图上找出k个最近邻居,让他们投票确定分类,类别判定为离它最近的k个观察值中所占比例最大的分类。Python数据科学与机器学习:从入门到实践。[美]弗兰克•凯恩(Frank Kane)

2023-04-20 21:29:08 448

原创 [leetcode] 720. Longest Word in Dictionary @ python

原题Given a list of strings words representing an English Dictionary, find the longest word in words that can be built one character at a time by other words in words. If there is more than one possibl...

2019-04-04 19:14:37 397

原创 [leetcode] 931. Minimum Falling Path Sum @ python

原题Given a square array of integers A, we want the minimum sum of a falling path through A.A falling path starts at any element in the first row, and chooses one element from each row. The next row’...

2019-04-04 08:42:45 212

原创 [leetcode] 120. Triangle @ python

原题Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the following triangle[[2],[3,4],[6,5,7],[4,1,8,...

2019-04-03 12:10:05 295

原创 [leetcode] 219. Contains Duplicate II @ python

原题Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the absolute difference between i and j is at most ...

2019-04-03 11:53:27 203

原创 [leetcode] 228. Summary Ranges @ python

原题Given a sorted integer array without duplicates, return the summary of its ranges.Example 1:Input: [0,1,2,4,5,7]Output: [“0->2”,“4->5”,“7”]Explanation: 0,1,2 form a continuous range; 4,5...

2019-04-03 11:43:29 206

原创 [leetcode] 890. Find and Replace Pattern @ python

原题You have a list of words and a pattern, and you want to know which words in words matches the pattern.A word matches the pattern if there exists a permutation of letters p so that after replacing ...

2019-04-02 11:11:58 355

原创 [leetcode] 680. Valid Palindrome II @ python

原题Given a non-empty string s, you may delete at most one character. Judge whether you can make it a palindrome.Example 1:Input: “aba”Output: TrueExample 2:Input: “abca”Output: TrueExplanation:...

2019-04-02 08:45:04 710

原创 [leetcode] 914. X of a Kind in a Deck of Cards @ python

原题In a deck of cards, each card has an integer written on it.Return true if and only if you can choose X >= 2 such that it is possible to split the entire deck into 1 or more groups of cards, whe...

2019-04-02 08:44:59 343

原创 [leetcode] 686. Repeated String Match @ python

原题Given two strings A and B, find the minimum number of times A has to be repeated such that B is a substring of it. If no such solution, return -1.For example, with A = “abcd” and B = “cdabcdab”.R...

2019-04-01 17:57:49 236

原创 [leetcode] 414. Third Maximum Number @ python

原题Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexity must be in O(n).Example 1:Input: [3, 2, 1]...

2019-04-01 15:40:49 137

原创 [leetcode] 859. Buddy Strings @ python

原题Given two strings A and B of lowercase letters, return true if and only if we can swap two letters in A so that the result equals B.Example 1:Input: A = “ab”, B = “ba”Output: trueExample 2:Inp...

2019-04-01 15:31:40 175

原创 [leetcode] 707. Design Linked List @ python

原题Design your implementation of the linked list. You can choose to use the singly linked list or the doubly linked list. A node in a singly linked list should have two attributes: val and next. val i...

2019-04-01 15:17:03 1037

原创 [leetcode]665. Non-decreasing Array @ python

原题Given an array with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element.We define an array is non-decreasing if array[i] <= array[i + 1] holds for...

2019-04-01 12:30:22 164

原创 [leetcode] 246. Strobogrammatic Number @ python

原题A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down).Write a function to determine if a number is strobogrammatic. The number is represented as...

2019-04-01 11:53:19 814

原创 [leetcode] 482. License Key Formatting @ python

原题You are given a license key represented as a string S which consists only alphanumeric character and dashes. The string is separated into N+1 groups by N dashes.Given a number K, we would want to ...

2019-04-01 11:40:17 190

原创 [leetcode] 849. Maximize Distance to Closest Person @ python

原题In a row of seats, 1 represents a person sitting in that seat, and 0 represents that the seat is empty.There is at least one empty seat, and at least one person sitting.Alex wants to sit in the s...

2019-04-01 11:29:29 201

原创 [leetcode] 734. Sentence Similarity @ python

原题Given two sentences words1, words2 (each represented as an array of strings), and a list of similar word pairs pairs, determine if two sentences are similar.For example, “great acting skills” and ...

2019-04-01 09:56:10 500

原创 [leetcode] 459. Repeated Substring Pattern @ python

原题Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. You may assume the given string consists of lowercase En...

2019-04-01 08:10:43 234

原创 [leetcode] 800. Similar RGB Color @ python

原题In the following, every capital letter represents some hexadecimal digit from 0 to f.The red-green-blue color “#AABBCC” can be written as “#ABC” in shorthand. For example, “#15c” is shorthand for...

2019-03-31 20:46:18 413

原创 [leetcode]788. Rotated Digits @ python

原题X is a good number if after rotating each digit individually by 180 degrees, we get a valid number that is different from X. Each digit must be rotated - we cannot choose to leave it alone.A numb...

2019-03-31 20:13:23 152

原创 [leetcode] 404. Sum of Left Leaves @ python

原题Find the sum of all left leaves in a given binary tree.Example:3/ 9 20/ 15 7There are two left leaves in the binary tree, with values 9 and 15 respectively. Return 24.解法递归. 创建全局变量self...

2019-03-31 19:24:23 179

原创 [leetcode]994. Rotting Oranges @ python

原题https://leetcode.com/problems/rotting-oranges/解法BFS. 首先遍历grid, 统计新鲜橘子的个数, 将腐烂橘子的index放入q. Edge case是当grid没有新鲜橘子时, 返回0. 然后使用BFS, 依次将腐烂橘子的index弹出, 查找四周的新鲜橘子并把它们变成腐烂橘子, 遍历一次后ans递增.当跳出循环后发现新鲜橘子的个数&gt...

2019-03-31 08:12:30 411

原创 [leetcode] 933. Number of Recent Calls @ python

原题Write a class RecentCounter to count recent requests.It has only one method: ping(int t), where t represents some time in milliseconds.Return the number of pings that have been made from 3000 mil...

2019-03-30 21:09:41 130

常用编程字体

包含10种常用编程字体 包含10种常用编程字体 包含10种常用编程字体 包含10种常用编程字体 包含10种常用编程字体

2018-07-05

空空如也

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

TA关注的人

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