07 2020 档案

摘要:机器学习算法-VAE 1. VAE模型推导 1.1 算法引入 ​ 在EM算法中,隐变量的最优分布$q^{\star}(\mathbf)$是在观测数据给定时的条件分布$p(\mathbf|\mathbf)$,此时对应的证据下界与似然函数相等。但是在实际中,后验概率可能很难计算甚至不能计算,这时EM算法 阅读全文
posted @ 2020-07-30 11:34 十三w~w 阅读(989) 评论(0) 推荐(0)
摘要:机器学习算法-GMM和EM算法 1. GMM模型 ​ 聚类问题是一个经典的无监督任务,其目标是将 \(N\) 个 \(D\) 维数据 \(\{\bf{x}_i\}_{i=1}^N\) 分成$K$个簇,使得每个簇中的样本尽可能相似。GMM算法对数据分布做了一些假设: 第$k$个簇数据点服从正态分布,即 阅读全文
posted @ 2020-07-30 09:05 十三w~w 阅读(1027) 评论(0) 推荐(0)
摘要:Range Sum Query - Mutable Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. The update(i, val) fun 阅读全文
posted @ 2020-07-27 15:54 十三w~w 阅读(87) 评论(0) 推荐(0)
摘要:Additive Number Additive number is a string whose digits can form additive sequence. A valid additive sequence should contain at least three numbers. 阅读全文
posted @ 2020-07-27 14:50 十三w~w 阅读(115) 评论(0) 推荐(0)
摘要:Range Sum Query 2D - Immutable Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col 阅读全文
posted @ 2020-07-26 15:07 十三w~w 阅读(109) 评论(0) 推荐(0)
摘要:Longest Increasing Subsequence Given an unsorted array of integers, find the length of longest increasing subsequence. Example: Input: [10,9,2,5,3,7,1 阅读全文
posted @ 2020-07-26 14:45 十三w~w 阅读(104) 评论(0) 推荐(0)
摘要:Game of Life According to the Wikipedia's article: "The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathem 阅读全文
posted @ 2020-07-26 14:34 十三w~w 阅读(140) 评论(0) 推荐(0)
摘要:Ugly Number II Write a program to find the n-th ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. Example: Inpu 阅读全文
posted @ 2020-07-25 14:02 十三w~w 阅读(136) 评论(0) 推荐(0)
摘要:H-Index II Given an array of citations sorted in ascending order (each citation is a non-negative integer) of a researcher, write a function to comput 阅读全文
posted @ 2020-07-23 19:24 十三w~w 阅读(96) 评论(0) 推荐(0)
摘要:Single Number III Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find 阅读全文
posted @ 2020-07-23 14:30 十三w~w 阅读(95) 评论(0) 推荐(0)
摘要:Search a 2D Matrix II Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in 阅读全文
posted @ 2020-07-23 14:08 十三w~w 阅读(119) 评论(0) 推荐(0)
摘要:Sliding Window Maximum Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You 阅读全文
posted @ 2020-07-23 11:35 十三w~w 阅读(116) 评论(0) 推荐(0)
摘要:Product of Array Except Self Given an array nums of n integers where n > 1, return an array output such that output[i] is equal to the product of all 阅读全文
posted @ 2020-07-23 10:42 十三w~w 阅读(89) 评论(0) 推荐(0)
摘要:在VSCode中写python时,import numpy和matplotlib总是报错找不到模块,用conda list和pip list看到都安装了numpy,前后折腾了很久遇到了好几个问题: 无法从PIL中导入Image 无法导入numpy.multiarray 无法找到numpy 前后尝试的 阅读全文
posted @ 2020-07-22 15:09 十三w~w 阅读(5959) 评论(0) 推荐(0)
摘要:Lowest Common Ancestor of a Binary Tree Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the de 阅读全文
posted @ 2020-07-21 16:29 十三w~w 阅读(92) 评论(0) 推荐(0)
摘要:Kth Smallest Element in a BST Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Example 1: Input: root 阅读全文
posted @ 2020-07-21 10:03 十三w~w 阅读(79) 评论(0) 推荐(0)
摘要:Majority Element II Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. Note: The algorithm should run in linear 阅读全文
posted @ 2020-07-21 09:53 十三w~w 阅读(105) 评论(0) 推荐(0)
摘要:Summary Ranges 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-> 阅读全文
posted @ 2020-07-20 15:24 十三w~w 阅读(93) 评论(0) 推荐(0)
摘要:Basic Calculator Implement a basic calculator to evaluate a simple expression string. The expression string may contain open ( and closing parentheses 阅读全文
posted @ 2020-07-20 15:18 十三w~w 阅读(132) 评论(0) 推荐(0)
摘要:Rectangle Area Find the total area covered by two rectilinear rectangles in a 2D plane. Each rectangle is defined by its bottom left corner and top ri 阅读全文
posted @ 2020-07-20 14:45 十三w~w 阅读(114) 评论(0) 推荐(0)
摘要:Count Complete Tree Nodes Given a complete binary tree, count the number of nodes. Note: Definition of a complete binary tree from Wikipedia: In a com 阅读全文
posted @ 2020-07-20 14:15 十三w~w 阅读(95) 评论(0) 推荐(0)
摘要:Maximal Square Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area. Example: Input: 1 0 阅读全文
posted @ 2020-07-18 17:29 十三w~w 阅读(126) 评论(0) 推荐(0)
摘要:Combination Sum III Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each co 阅读全文
posted @ 2020-07-18 15:42 十三w~w 阅读(109) 评论(0) 推荐(0)
摘要:Kth Largest Element in an Array Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not th 阅读全文
posted @ 2020-07-18 15:08 十三w~w 阅读(105) 评论(0) 推荐(0)
摘要:House Robber II You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at t 阅读全文
posted @ 2020-07-17 21:32 十三w~w 阅读(124) 评论(0) 推荐(0)
摘要:LeetCode中出现了2sum, 3sum, 4sum的问题,文章给出了一种通用的解法,想法是将n_sum问题转换为(n-1)_sum问题,具体步骤如下: 定义函数sum(n, target),表示求解和为target的nsum问题 step1:排序,这样2sum问题可以用双指针解决,时间复杂度为 阅读全文
posted @ 2020-07-17 13:01 十三w~w 阅读(367) 评论(0) 推荐(0)
摘要:机器学习算法——SVM 1. 背景 ​ 在线性分类任务中,对于同一个数据集,可能有多个分离超平面。例如在下图中,H2和H3都能够将白色点和黑色点分离开来,那么在这些分界面中,是否存在一个最优的分界面?一个直观的想法是,离所有点都比较远的分割面会是一个好的分割面。可以证明,这样的最优分割面是唯一的。因 阅读全文
posted @ 2020-07-17 09:52 十三w~w 阅读(324) 评论(0) 推荐(0)
摘要:Add and Search Word - Data structure design Design a data structure that supports the following two operations: void addWord(word) bool search(word) s 阅读全文
posted @ 2020-07-16 16:26 十三w~w 阅读(92) 评论(0) 推荐(0)
摘要:Course Schedule II There are a total of n courses you have to take, labeled from 0 to n-1. Some courses may have prerequisites, for example to take co 阅读全文
posted @ 2020-07-16 15:40 十三w~w 阅读(127) 评论(0) 推荐(0)
摘要:Minimum Size Subarray Sum Given an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarray of which th 阅读全文
posted @ 2020-07-16 15:24 十三w~w 阅读(139) 评论(0) 推荐(0)
摘要:Implement Trie (Prefix Tree) Implement a trie with insert, search, and startsWith methods. Example: Trie trie = new Trie(); trie.insert("apple"); trie 阅读全文
posted @ 2020-07-16 14:53 十三w~w 阅读(103) 评论(0) 推荐(0)
摘要:Count Primes Count the number of prime numbers less than a non-negative number, *n*. Example: Input: 10 Output: 4 Explanation: There are 4 prime numbe 阅读全文
posted @ 2020-07-15 10:10 十三w~w 阅读(115) 评论(0) 推荐(0)
摘要:Isomorphic Strings Given two strings *s* and *t*, determine if they are isomorphic. Two strings are isomorphic if the characters in *s* can be replace 阅读全文
posted @ 2020-07-15 09:38 十三w~w 阅读(98) 评论(0) 推荐(0)
摘要:Course Schedule There are a total of numCourses courses you have to take, labeled from 0 to numCourses-1. Some courses may have prerequisites, for exa 阅读全文
posted @ 2020-07-15 09:22 十三w~w 阅读(140) 评论(0) 推荐(0)
摘要:Remove Linked List Elements Remove all elements from a linked list of integers that have value *val*. Example: Input: 1->2->6->3->4->5->6, val = 6 Out 阅读全文
posted @ 2020-07-15 08:45 十三w~w 阅读(90) 评论(0) 推荐(0)
摘要:机器学习之树模型 大纲 决策树和回归树模型:ID3, C4.5,CART AdaBoost框架 提升树:梯度提升树 决策树 决策树模型可以看做是if-else指令集合,通过对特征空间的划分来完成分类或者回归任务。以下图中的分类任务为例,假设数据集包含了: 三个类别:黄色、蓝色、绿色 两个维度的特征空 阅读全文
posted @ 2020-07-14 22:18 十三w~w 阅读(292) 评论(0) 推荐(0)
摘要:Happy Number Write an algorithm to determine if a number n is "happy". A happy number is a number defined by the following process: Starting with any 阅读全文
posted @ 2020-07-14 22:11 十三w~w 阅读(126) 评论(0) 推荐(0)
摘要:Bitwise AND of Numbers Range Given a range [m, n] where 0 ⇐ m ⇐ n ⇐ 2147483647, return the bitwise AND of all numbers in this range, inclusive. Exampl 阅读全文
posted @ 2020-07-14 21:34 十三w~w 阅读(109) 评论(0) 推荐(0)
摘要:Number of Islands Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by 阅读全文
posted @ 2020-07-14 18:45 十三w~w 阅读(112) 评论(0) 推荐(0)
摘要:Binary Tree Right Side View Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered 阅读全文
posted @ 2020-07-14 18:11 十三w~w 阅读(73) 评论(0) 推荐(0)
摘要:House Robber You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constrain 阅读全文
posted @ 2020-07-14 16:55 十三w~w 阅读(129) 评论(0) 推荐(0)
摘要:Number of 1 Bits Write a function that takes an unsigned integer and return the number of '1' bits it has (also known as the Hamming weight). Example 阅读全文
posted @ 2020-07-14 16:27 十三w~w 阅读(104) 评论(0) 推荐(0)
摘要:在阅读论文Understanding Black-box Predictions via Influence Functions时,看见了一种计算逆矩阵$H^{-1}$的方法: 定义$H_j^{-1} = \sum_j (I-H)i$,有$\mathbb[H_j{-1}] = H{-1}(j\rig 阅读全文
posted @ 2020-07-14 16:25 十三w~w 阅读(202) 评论(0) 推荐(0)
摘要:Reverse Bits Reverse bits of a given 32 bits unsigned integer. Example 1: Input: 00000010100101000001111010011100 Output: 0011100101111000001010010100 阅读全文
posted @ 2020-07-13 11:03 十三w~w 阅读(119) 评论(0) 推荐(0)
摘要:Best Time to Buy and Sell Stock IV Say you have an array for which the i-th element is the price of a given stock on day i. Design an algorithm to fin 阅读全文
posted @ 2020-07-13 10:47 十三w~w 阅读(137) 评论(0) 推荐(0)
摘要:Best Time to Buy and Sell Stock III Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to fin 阅读全文
posted @ 2020-07-13 10:41 十三w~w 阅读(110) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-07-13 10:34 十三w~w 阅读(106) 评论(0) 推荐(0)
摘要:Best Time to Buy and Sell Stock Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to 阅读全文
posted @ 2020-07-13 10:31 十三w~w 阅读(125) 评论(0) 推荐(0)
摘要:Largest Number Given a list of non negative integers, arrange them such that they form the largest number. Example 1: Input: [10,2] Output: "210" Exam 阅读全文
posted @ 2020-07-12 18:21 十三w~w 阅读(140) 评论(0) 推荐(0)
摘要:Fraction to Recurring Decimal Given two integers representing the numerator and denominator of a fraction, return the fraction in string format. If th 阅读全文
posted @ 2020-07-12 16:39 十三w~w 阅读(116) 评论(0) 推荐(0)
摘要:Compare Version Numbers Compare two version numbers version1 and version2. If *version1* > *version2* return 1; if *version1* < *version2* return -1;o 阅读全文
posted @ 2020-07-12 14:31 十三w~w 阅读(143) 评论(0) 推荐(0)
摘要:机器学习算法——kNN 1. 算法原理 基本思想是物以类聚,相同类别的样本之间在特征空间中应当聚集在一起,因此对于新的数据点,根据其附近的K个邻居的类型可以对其进行预测。如下图所示,假设红、绿、蓝三种颜色的点分布在二维空间中,这对应着分类任务中的训练样点包含了3个类别,特征数量为2。如果现在我们希望 阅读全文
posted @ 2020-07-09 20:42 十三w~w 阅读(191) 评论(0) 推荐(0)
摘要:Maximum Gap Given an unsorted array, find the maximum difference between the successive elements in its sorted form. Return 0 if the array contains le 阅读全文
posted @ 2020-07-08 14:20 十三w~w 阅读(91) 评论(0) 推荐(0)
摘要:Find Peak Element A peak element is an element that is greater than its neighbors. Given an input array nums, where nums[i] ≠ nums[i+1], find a peak e 阅读全文
posted @ 2020-07-08 12:08 十三w~w 阅读(102) 评论(0) 推荐(0)
摘要:Find Minimum in Rotated Sorted Array II Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4 阅读全文
posted @ 2020-07-07 15:35 十三w~w 阅读(109) 评论(0) 推荐(0)
摘要:Find Minimum in Rotated Sorted Array Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5, 阅读全文
posted @ 2020-07-07 15:18 十三w~w 阅读(77) 评论(0) 推荐(0)
摘要:Maximum Product Subarray Given an integer array nums, find the contiguous subarray within an array (containing at least one number) which has the larg 阅读全文
posted @ 2020-07-07 14:55 十三w~w 阅读(91) 评论(0) 推荐(0)
摘要:Reverse Words in a String Given an input string, reverse the string word by word. Example 1: Input: "the sky is blue" Output: "blue is sky the" Exampl 阅读全文
posted @ 2020-07-07 14:25 十三w~w 阅读(106) 评论(0) 推荐(0)
摘要:Sort List Sort a linked list in O(n log n) time using constant space complexity. Example 1: Input: 4->2->1->3 Output: 1->2->3->4 Example 2: Input: -1- 阅读全文
posted @ 2020-07-07 13:46 十三w~w 阅读(102) 评论(0) 推荐(0)
摘要:Evaluate Reverse Polish Notation Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, *, /. Each opera 阅读全文
posted @ 2020-07-07 12:05 十三w~w 阅读(82) 评论(0) 推荐(0)
摘要:Insertion Sort List Sort a linked list using insertion sort. A graphical example of insertion sort. The partial sorted list (black) initially contains 阅读全文
posted @ 2020-07-06 22:23 十三w~w 阅读(90) 评论(0) 推荐(0)
摘要:发现了一个好玩的模板Silence,地址为[https://www.cnblogs.com/esofar/p/cnblogs-theme-silence.html] 按照github上的配置教程即可完成配置~ 阅读全文
posted @ 2020-07-06 21:24 十三w~w 阅读(246) 评论(0) 推荐(0)