原创 快排 冒泡 選擇 插入 歸併排序算法

快排 #include <bits/stdc++.h> using namespace std; void quick_sort(vector<int>&q, int l, int r) { if(l >= r) re

原创 從零開始的刷LeetCode生活 第38期 391-400

class Solution { public: bool isRectangleCover(vector<vector<int>>& rectangles) { int x1 = INT_MAX;

原创 從零開始的刷LeetCode生活 第41期 432-440

class Solution { public: int minMutation(string start, string end, vector<string>& bank) { if(start.

原创 【ML&DL學習】3 tf keras classification model callbacks

下面學習一下如何在tf keras使用回調函數 回調函數:當你在訓練模型的時候中間做的一些事情 一般常用的: EarlyStopping,當模型訓練的loss不在下降的時候,可以提前停止 ModelCheckPoint,每一

原创 【ML&DL學習】12 tf tfrecord basic api generate tfrecord

先把dataset轉出tfrecord格式,再用tf.data進行讀取,然後模型進行訓練 # tfrecord 文件格式 # -> tf.train.Example # -> tf.train.Features -> {"k

原创 【ML&DL學習】6 tf keras regression hp search sklearn

超參數搜索 搜索策略: 網格搜索 隨機搜索 遺傳算法搜索 啓發式搜索 手動搜索 learning rate # learning_rate: [1e-4, 3e-4, 1e-3, 3e-3, 1e-2, 3e-2]

原创 Leetcode總結 鏈表專題

/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListN

原创 【ML&DL學習】5 tf keras regression wide deep subclass multiinput multioutput

Wide & Deep 模型 分類求一個分佈,迴歸求一個數值 用向量表達出 詞與詞之間的距離 Wide模型只有一層,所有輸入直接連接輸出,輸入是稀疏特徵,也就是one-hot表達,one-hot表達每個分量直接連接

原创 【ML&DL學習】0 如何理解手寫數字識別網絡

ML目標 從數據中學習到一些高層次的抽象的一些概念,這樣的話,對於一個新數據x,也能預測出比較符合實際情況的y。 而自然界的y往往有兩種:離散和連續。 連續值預測: 線性方程: 可以求出w和b精確解,但是在現實生活中,我們不能

原创 【ML&DL學習】18 kaggle 10 monkeys model and resnet50 finetune

上傳下載notebook 運行第一行 導入庫 %matplotlib inline import matplotlib as mpl import matplotlib.pyplot as plt import nu

原创 【ML&DL學習】14 tf premade estimator

預定義estimator使用 # 定義一個文件保存中間輸出模型 output_dir = 'baseline_model' if not os.path.exists(output_dir): os.mkdir(outp

原创 【ML&DL學習】15 tf1 dense network dataset

tf1.0 hidden_units = [100, 100] class_num = 10 # 存放數據 x = tf.placeholder(tf.float32, [None, 28 * 28]) y = tf.pl

原创 【ML&DL學習】10 tf diffs and keras regression manu diffs

自定義求導 def f(x): return 3. * x ** 2 + 2. * x - 1 def approximate_derivative(f, x, eps=1e-3): #向左移動eps的值 向右移動ep

原创 從零開始的刷LeetCode生活 第51期 557-575

class Solution { public: string reverseWords(string s) { int front = 0, back = 0; for(int i =

原创 從零開始的刷LeetCode生活 第49期 521-537

class Solution { public: int findLUSlength(string a, string b) { if(a == b) return -1;