原创 matplotlib畫圖:當循環生成的圖過多時,會提示內存不夠等或與內存相關的error提示

總會要畫大量的圖,我是在一個for中循環畫圖,每當畫到第250張到300張左右,總遇到提示說內存不夠了或者直接Spyder死掉崩掉這樣的情況。一開始也很無奈,看到有的帖子說,要將32位的python換到64位,其實也還是沒有解決根本問題。

原创 Jupyter插件Nbextensions

  同事有介紹一個Jupyter的插件Nbextensions很好用,可以使得使用Jupyter的時候交互更便捷一些,因此也開始嘗試試用起來。 1.安裝nbextensions 我是用的pythonIDE是anaconda,因此具體安裝如

原创 樸素貝葉斯的三個常用模型:高斯、多項式、伯努利

部分內容轉自:https://blog.csdn.net/qq_27009517/article/details/80044431 0.樸素貝葉斯 樸素貝葉斯分類(NBC,Naive Bayes Classifier)是以貝葉斯定理爲基礎

原创 機器學習中L1 L2正則化項(範式,懲罰項)

1. 什麼是L1 L2? 正則化項,範式,懲罰項是不同學科範疇的學者的不同叫法,具體如下: 在機器學習稱作正則化; 統計學領域稱作懲罰項; 數學界會稱作範數。 L1範數:L1範數就是曼哈頓距離,向量中每個元素絕對值的和   L2範數:L2

原创 隨機森林(Random Forest)

 閱讀目錄 •1 什麼是隨機森林? •2 隨機森林的特點 •3 隨機森林的相關基礎知識 •4 隨機森林的生成 •5 袋外錯誤率(oob error) •6 隨機森林工作原理解釋的一個簡單例子 •7 隨機森林的Python實現 •8

原创 leetcode 36. Valid Sudoku

題目: Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules. 只是判斷,當前的數獨是否是有效狀態而已。。。並不是要解一個數獨。 The

原创 leetcode 32. Longest Valid Parentheses

題目: Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) pa

原创 leetcode 22. Generate Parentheses

題目: Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. n:n對兒括號,

原创 leetcode 24. Swap Nodes in Pairs

題目: Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2->3->4, you shoul

原创 leetcode 34. Search for a Range

題目: Given a sorted array of integers, find the starting and ending position of a given target value. 一個已經排序好的整型數組,給一個目標

原创 leetcode 33.Search in Rotated Sorted Array

題目: Suppose a sorted array is rotated at some pivot unknown to you beforehand. 假定一個數組是有序的,i.e., 0 1 2 4 5 6 7 可能在某個

原创 leetcode 31. Next Permutation

題目: Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers

原创 leetcode 23. Merge k Sorted Lists

題目: Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 合併k個排好序的的鏈,並且返回

原创 leetcode 30. Substring with Concatenation of All Words

題目: You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices o

原创 leetcode 35. Search Insert Position

題目: Given a sorted array and a target value, return the index if the target is found. If not, return the index where it