原创 pandas去除某幾列相同數據的記錄並保存

1 問題 現在有這樣一個需求,在一份記錄着微信聊天記錄的 csv 文件中,去除同一天同一個人發的相同消息的記錄。 2 實現代碼 # -*- coding: utf-8 -*- import pandas as pd import os

原创 python實現選擇排序算法

class Sort: # 選擇排序 # 算法思想:不斷尋找剩餘元素中最小的一個與當前位置元素交換 # 算法特性: # (1)運行時間與輸入的初始狀態無關 # (2)數據移動是最少的

原创 python實現插入排序算法

class Sort: # 插入排序0 # 算法思想:將當前元素插入到左邊以排序好的序列中,插入過程中兩兩比較交換位置實現元素插入到所在位置 # 算法特性: # (1)與初始狀態有關 # 時間複

原创 Leetcode-Remove Duplicates from Sorted Array(Python)

1 Description(描述) Given a sorted array nums, remove the duplicates in-place such that each element appear only once a

原创 Leetcode-Remove Element(Python)

1 Description(描述) Given an array nums and a value val, remove all instances of that value in-place and return the new

原创 Leetcode-Merge Two Sorted Lists(Python)

1 Description(描述) Merge two sorted linked lists and return it as a new list. The new list should be made by splicing

原创 Leetcode-Longest Common Prefix(Python)

1 Description(描述) Write a function to find the longest common prefix string amongst an array of strings. If there is

原创 Leetcode-Valid Parentheses(Python)

1 Description(描述) Given a string containing just the characters ‘(’, ‘)’, ‘{’, ‘}’, ‘[’ and ‘]’, determine if the inp

原创 感知機學習算法的原始形式及其Python實現

1 描述 (1)模型: 其中 w * x 表示 w 與 x 的內積,sign 爲符號函數,當 w * x + b >= 0時,爲 1,否則爲 -1。 (2)策略: 損失函數: 其中 M 爲誤分類點的集合。 (3)算法: 因此將問

原创 神經網絡中誤差值計算公式的選取

(1)第一種可以清晰地看到由於正負抵消,總體誤差和爲0相當於總體沒有誤差,即使正負不能完全抵消也不符合真實情況。因此這種方式不是一種很好的測量方式。 (2)第二種採用絕對值,因爲不考慮符號,解決了誤差相互抵消問題。但這樣的誤差函數圖

原创 手動搭建神經網絡應用於手寫數字識別

import numpy as np import scipy.special import matplotlib.pyplot as plt from PIL import Image class neuralNetwork :

原创 爲什麼誤差可以指導更新權重

注:來源於《Python神經網絡編程》

原创 對神經網絡前後層神經元全連接的重新認識

(1)這種完全連接的方式容易編碼成計算機指令,即每個神經元工作方式相同,不用特殊考慮,容易編程。 (2)神經網絡在學習過程中,對不需要連接的權重會弱化(無限趨近於0或等於0),因此相當於斷開連接。 (3)使用創造性方式連接神經元,這樣

原创 Leetcode-Roman to Integer

1 Description(描述) Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. 羅馬數字通過其中不同的符號來表示

原创 K近鄰算法(KNN)的簡單python實現

1 算法思想 給定測試樣本,基於某種距離度量找出訓練集中與其最靠近的 k 個訓練樣本,然後基於這 k 個“鄰居”的信息來進行預測。通常,在分類任務中可使用“投票法”,即選擇這 k 個樣本中出現最多的類別標記作爲預測結果;在迴歸任務中可