" />

最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

使用Python代碼識(shí)別股票價(jià)格圖表模式實(shí)現(xiàn)

 更新時(shí)間:2023年12月06日 10:22:29   作者:deephub  
這篇文章主要為大家介紹了使用Python代碼識(shí)別股票價(jià)格圖表模式的實(shí)現(xiàn)示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪

正文

在股票市場(chǎng)交易的動(dòng)態(tài)環(huán)境中,技術(shù)和金融的融合催生了分析市場(chǎng)趨勢(shì)和預(yù)測(cè)未來(lái)價(jià)格走勢(shì)的先進(jìn)方法,本文將使用Python進(jìn)行股票模式識(shí)別

from collections import defaultdict
 
 import numpy as np
 import pandas as pd
 import matplotlib.pyplot as plt
 from scipy.signal import argrelextrema
 from statsmodels.nonparametric.kernel_regression import KernelReg
 from yahoofinancials import YahooFinancials

python庫(kù)介紹

上面的庫(kù)中,有幾個(gè)要點(diǎn)需要介紹:

collections.defaultdict當(dāng)缺少鍵時(shí),返回默認(rèn)值。使用它可以有效地存儲(chǔ)和組織數(shù)據(jù),比如鍵反映日期或資產(chǎn)符號(hào)等可識(shí)別的度量,值表示相應(yīng)的變量。

argrelextrema函數(shù)是SciPy庫(kù)中的一個(gè)函數(shù),用于進(jìn)行科學(xué)計(jì)算和技術(shù)計(jì)算。它有助于識(shí)別價(jià)格數(shù)據(jù)中的局部最大值和最小值,指示價(jià)格數(shù)據(jù)中的潛在轉(zhuǎn)折點(diǎn)或支撐位和阻力位。

statsmodels.nonparametric.kernel_regression.KernelReg:這個(gè)來(lái)自statmodels的子模塊提供了非參數(shù)核回歸功能。交易可以使用這種方法來(lái)擬合價(jià)格數(shù)據(jù)的平滑曲線,以確定趨勢(shì),無(wú)需假設(shè)曲線具有特定的參數(shù)形式。

YahooFinancials:該模塊從雅虎財(cái)經(jīng)獲取財(cái)務(wù)數(shù)據(jù)。我們可以訪問(wèn)大量的財(cái)務(wù)數(shù)據(jù),包括股票價(jià)格,財(cái)務(wù)報(bào)表和其他市場(chǎng)數(shù)據(jù),用于分析和決定如何處理投資組合。

start_date = '2017-01-01'
 end_date = '2017-12-31'
 stock_code = 'FB' # e.g. AMZN, GOOG, FB, NVDA

我們獲取的股票數(shù)據(jù)是在2017-01-01至2017-12-31期間。作為stock_code變量,F(xiàn)acebook, Inc.被設(shè)置為FB,即股票的代碼。

在指定的日期范圍內(nèi),交易算法將執(zhí)行該股票代碼的數(shù)據(jù)分析、交易信號(hào)或?qū)嶋H交易等操作。此代碼的目的是為交易算法建立基本參數(shù):目標(biāo)時(shí)間框架和交易的特定股票。

變量最終將在代碼中用于獲取歷史數(shù)據(jù)、執(zhí)行財(cái)務(wù)分析和回溯測(cè)試交易策略。對(duì)于任何專注于股票市場(chǎng)的交易系統(tǒng),這些參數(shù)是評(píng)估歷史表現(xiàn)和執(zhí)行實(shí)時(shí)交易的關(guān)鍵輸入。

def preprocess_data(start_date, end_date, stock_code):
     stock_data = YahooFinancials(stock_code).get_historical_price_data(start_date, end_date, 'daily')
     price_data = stock_data[stock_code]['prices']
     columns = ['formatted_date', 'open', 'high', 'low', 'close', 'adjclose', 'volume']
     new_columns = ['Date', 'Open', 'High', 'Low', 'Close', 'Adj Close', 'Volume']
     df = pd.DataFrame(data=price_data)[columns] # order dataframe columns
     df = df.rename(index=str, columns=dict(zip(columns, new_columns))) # rename dataframe columns
     return df, df['Close'], df['Date']

preprocess_data參數(shù)

preprocess_data有三個(gè)參數(shù):start_date、end_date和stock_code,它們指定時(shí)間范圍和股票類型。此函數(shù)的主要目標(biāo)是從Financials檢索給定股票的指定日期范圍內(nèi)的歷史股票價(jià)格。

獲取包括全面的金融信息,包括每日股票價(jià)格、開(kāi)盤價(jià)、最高價(jià)和最低價(jià),以及調(diào)整后的收盤價(jià)。獲得數(shù)據(jù)后,將其組織到pandas DataFrame中,

通過(guò)重命名列,可以實(shí)現(xiàn)更好的可讀性和與通用財(cái)務(wù)數(shù)據(jù)標(biāo)準(zhǔn)的一致性。該函數(shù)返回處理后的DataFrame以及兩個(gè)Series一維數(shù)組,其中包括收盤價(jià)和收盤價(jià)發(fā)生的日期。

df, prices, dates = preprocess_data(start_date, end_date, stock_code)
 prices.index = np.linspace(1, len(prices), len(prices))
 dates.index = np.linspace(1, len(dates), len(dates))

我們?yōu)閮山M數(shù)據(jù)(價(jià)格和日期)設(shè)置索引。然后就是對(duì)價(jià)格的分析和局部最大值和最小值的識(shí)別,這對(duì)交易者來(lái)說(shuō)是非常寶貴的。代碼采用了一個(gè)核心回歸模型,消除價(jià)格的周期性波動(dòng),從而更容易發(fā)現(xiàn)重要的趨勢(shì)。

# https://onlinelibrary.wiley.com/doi/full/10.1111/0022-1082.00265
 # reference: https://www.quantopian.com/posts/an-empirical-algorithmic-evaluation-of-technical-analysis
 def find_max_min(prices):
     model = KernelReg(prices.values, prices.index.values, var_type='c', bw='cv_ls')
     smooth_prices = pd.Series(data=model.fit([prices.index.values])[0], index=prices.index) # index also from 1
     # use the minima and maxima from the smoothed timeseries
     # to identify true local minima and maxima in the original timeseres
     # by taking the maximum/minimum price within a t-1, t+1 window in the smoothed timeseries
     smooth_prices_max_indices = argrelextrema(smooth_prices.values, np.greater)[0]
     smooth_prices_min_indices = argrelextrema(smooth_prices.values, np.less)[0]
     price_max_indices = []
     for i in smooth_prices_max_indices:
         if 1 < i < len(prices)-1:
             price_max_indices.append(prices.iloc[i-2:i+2].idxmax())
     price_min_indices = []
     for i in smooth_prices_min_indices:
         if 1 < i < len(prices)-1:
             price_min_indices.append(prices.iloc[i-2:i+2].idxmin())
     price_max = prices.loc[price_max_indices]
     price_min = prices.loc[price_min_indices]
     max_min = pd.concat([price_max, price_min]).sort_index()
     max_min = max_min[~max_min.duplicated()] # deduplicate points that are both maximum and minimum
     max_min
     return smooth_prices, smooth_prices_max_indices, smooth_prices_min_indices, \
             price_max_indices, price_min_indices, max_min

算法識(shí)別基于平滑價(jià)格數(shù)據(jù)的價(jià)格曲線改變方向的點(diǎn)

用一種算法來(lái)識(shí)別基于平滑價(jià)格數(shù)據(jù)的價(jià)格曲線改變方向的點(diǎn),代碼在這個(gè)平滑的時(shí)間序列中搜索相對(duì)最大值和最小值。代碼試圖在平滑數(shù)據(jù)中找到這些極值后,將這些極值映射回原始的非平滑價(jià)格數(shù)據(jù)。

它通過(guò)檢查平滑數(shù)據(jù)中每個(gè)極值點(diǎn)周圍的小窗口來(lái)實(shí)現(xiàn)這一點(diǎn),并確定該窗口內(nèi)的價(jià)格最高或最低-這些是真正的局部最大值和最小值。在平滑和窗口化處理完成之后,代碼將這些點(diǎn)組織到一個(gè)內(nèi)聚輸出中,刪除可能同時(shí)存在于最大值和最小值的任何重復(fù)點(diǎn)。

可以使用這個(gè)結(jié)果來(lái)確定交易的進(jìn)入和退出點(diǎn)。除了在代碼中使用外,該代碼還可以用于更大的策略中,根據(jù)這些發(fā)現(xiàn)觸發(fā)買入或賣出信號(hào)。

smooth_prices, smooth_prices_max_indices, smooth_prices_min_indices, \
             price_max_indices, price_min_indices, max_min = find_max_min(prices

smooth_prices包

smooth_prices包含平滑版本的價(jià)格數(shù)據(jù),可以消除噪音,使趨勢(shì)更容易識(shí)別。

有各種各樣的技術(shù)可用于平滑,包括移動(dòng)平均線和其他算法。變量smooth_prices_max_indices和smooth_prices_min_indices可能表示平滑價(jià)格指數(shù)在局部最大值和最小值列表中的位置。當(dāng)價(jià)格達(dá)到這些水平時(shí),在價(jià)格反轉(zhuǎn)之前識(shí)別潛在的買入或賣出信號(hào)是至關(guān)重要的。與前面的變量一樣,price_max_indices和price_min_indices是從原始的、未平滑的價(jià)格中計(jì)算出來(lái)的。

max_min可能是一個(gè)數(shù)組或列表,其中包含有關(guān)已識(shí)別的最大值和最小值的信息,可能結(jié)合平滑和非平滑數(shù)據(jù),用于根據(jù)本地價(jià)格極值確定是否進(jìn)入或退出頭寸。可以分析金融價(jià)格數(shù)據(jù),識(shí)別峰值和低谷,并準(zhǔn)備數(shù)據(jù)用于算法交易。作為更大的技術(shù)分析系統(tǒng)的一部分,它可以用于基于歷史價(jià)格模式的自動(dòng)交易活動(dòng)。

下面我們看看上面代碼計(jì)算得到的結(jié)果:

fig, ax = plt.subplots(figsize=(20,10), dpi=200)
 ax.plot(dates, prices, label='Prices')
 ax.plot(dates, smooth_prices, label='Smoothed Prices', linestyle='dashed')
 ax.set_xticks(np.arange(0, len(dates), 30))
 smooth_prices_max = smooth_prices.loc[smooth_prices_max_indices]
 smooth_prices_min = smooth_prices.loc[smooth_prices_min_indices]
 price_max = prices.loc[price_max_indices]
 price_min = prices.loc[price_min_indices]
 ax.scatter(dates.loc[smooth_prices_max.index], smooth_prices_max.values, s=20, color='red', label='Smoothed Prices Maxima')
 ax.scatter(dates.loc[smooth_prices_min.index], smooth_prices_min.values, s=20, color='purple', label='Smoothed Prices Minima')
 ax.scatter(dates.loc[price_max.index], price_max.values, s=50, color='green', label='Prices Maxima')
 ax.scatter(dates.loc[price_min.index], price_min.values, s=50, color='blue', label='Prices Minima')
 ax.legend(loc='upper left')
 ax.grid()

代碼繪制了具有不同線條風(fēng)格的實(shí)際價(jià)格和平滑價(jià)格。該圖還顯示了實(shí)際和平滑價(jià)格數(shù)據(jù)中局部最大值和最小值的位置,可能識(shí)別交易進(jìn)入和退出信號(hào)。

為了區(qū)分最大值和最小值,使用較大的符號(hào)和不同的顏色。時(shí)間軸每隔一段時(shí)間顯示在x軸上,以使其更清晰。圖表的圖例解釋了情節(jié)元素,網(wǎng)格有助于分析價(jià)格隨時(shí)間的變化,這些都是在繪圖中必不可少的工作。

下面一個(gè)函數(shù)是Plot_window,它生成一個(gè)折線圖,顯示實(shí)際價(jià)格和平滑價(jià)格隨時(shí)間的變化。平滑可能有助于識(shí)別趨勢(shì)并過(guò)濾掉噪聲。在這張圖上可以區(qū)分出幾個(gè)關(guān)鍵點(diǎn)。顏色和大小用于識(shí)別實(shí)際和平滑價(jià)格曲線的局部最大值和最小高點(diǎn)和低點(diǎn)。交易策略通常關(guān)注這些關(guān)鍵點(diǎn),因?yàn)樗鼈兛赡茴A(yù)示著趨勢(shì)的逆轉(zhuǎn)或繼續(xù)。

def plot_window(dates, prices, smooth_prices, 
                 smooth_prices_max_indices, smooth_prices_min_indices,
                 price_max_indices, price_min_indices, 
                 start, end, ax=None):
     if ax is None: fig, ax = plt.subplots(figsize=(20,10), dpi=200)
 
     ax.plot(dates.loc[start:end], prices.loc[start:end], label='Prices')
     ax.plot(dates.loc[start:end], smooth_prices.loc[start:end], label='Smoothed Prices', linestyle='dashed')
     ax.set_xticks(np.linspace(0, len(dates.loc[start:end]), 10))
     ax.tick_params(axis='x', rotation=45)
 
     smooth_prices_max = smooth_prices.loc[smooth_prices_max_indices].loc[start:end]
     smooth_prices_min = smooth_prices.loc[smooth_prices_min_indices].loc[start:end]
     price_max = prices.loc[price_max_indices].loc[start:end]
     price_min = prices.loc[price_min_indices].loc[start:end]
 
     ax.scatter(dates.loc[smooth_prices_max.index], smooth_prices_max.values, s=20, color='red', label='Smoothed Prices Maxima')
     ax.scatter(dates.loc[smooth_prices_min.index], smooth_prices_min.values, s=20, color='purple', label='Smoothed Prices Minima')
 
     ax.scatter(dates.loc[price_max.index], price_max.values, s=50, color='green', label='Prices Maxima')
     ax.scatter(dates.loc[price_min.index], price_min.values, s=50, color='blue', label='Prices Minima')
     ax.legend(fontsize='small')
     ax.grid()

可以在較大的數(shù)據(jù)集中指定一個(gè)從開(kāi)始到結(jié)束的時(shí)間窗口,這樣可以查看數(shù)據(jù)的子集。為了清晰起見(jiàn),在x軸上顯示日期的同時(shí)還顯示了一個(gè)圖例和一個(gè)網(wǎng)格。

plot_window(dates, prices, smooth_prices, 
             smooth_prices_max_indices, smooth_prices_min_indices,
             price_max_indices, price_min_indices, 
             start=18, end=34, ax=None)

簡(jiǎn)單的模式

下面我們可以尋找一些簡(jiǎn)單的模式:

def find_patterns(max_min):
     patterns = defaultdict(list)
     for i in range(5, len(max_min)):
         window = max_min.iloc[i-5:i]
         # pattern must play out in less than 36 days
         if window.index[-1] - window.index[0] > 35:
             continue
         # Using the notation from the paper to avoid mistakes
         e1, e2, e3, e4, e5 = window.iloc[:5]
         rtop_g1 = np.mean([e1, e3, e5])
         rtop_g2 = np.mean([e2, e4])
         # Head and Shoulders
         if (e1 > e2) and (e3 > e1) and (e3 > e5) and \
             (abs(e1 - e5) <= 0.03*np.mean([e1,e5])) and \
             (abs(e2 - e4) <= 0.03*np.mean([e1,e5])):
                 patterns['HS'].append((window.index[0], window.index[-1]))
         # Inverse Head and Shoulders
         elif (e1 < e2) and (e3 < e1) and (e3 < e5) and \
             (abs(e1 - e5) <= 0.03*np.mean([e1,e5])) and \
             (abs(e2 - e4) <= 0.03*np.mean([e1,e5])):
                 patterns['IHS'].append((window.index[0], window.index[-1]))
         # Broadening Top
         elif (e1 > e2) and (e1 < e3) and (e3 < e5) and (e2 > e4):
             patterns['BTOP'].append((window.index[0], window.index[-1]))
         # Broadening Bottom
         elif (e1 < e2) and (e1 > e3) and (e3 > e5) and (e2 < e4):
             patterns['BBOT'].append((window.index[0], window.index[-1]))
         # Triangle Top
         elif (e1 > e2) and (e1 > e3) and (e3 > e5) and (e2 < e4):
             patterns['TTOP'].append((window.index[0], window.index[-1]))
         # Triangle Bottom
         elif (e1 < e2) and (e1 < e3) and (e3 < e5) and (e2 > e4):
             patterns['TBOT'].append((window.index[0], window.index[-1]))
         # Rectangle Top
         elif (e1 > e2) and (abs(e1-rtop_g1)/rtop_g1 < 0.0075) and \
             (abs(e3-rtop_g1)/rtop_g1 < 0.0075) and (abs(e5-rtop_g1)/rtop_g1 < 0.0075) and \
             (abs(e2-rtop_g2)/rtop_g2 < 0.0075) and (abs(e4-rtop_g2)/rtop_g2 < 0.0075) and \
             (min(e1, e3, e5) > max(e2, e4)):
             patterns['RTOP'].append((window.index[0], window.index[-1]))
         # Rectangle Bottom
         elif (e1 < e2) and (abs(e1-rtop_g1)/rtop_g1 < 0.0075) and \
             (abs(e3-rtop_g1)/rtop_g1 < 0.0075) and (abs(e5-rtop_g1)/rtop_g1 < 0.0075) and \
             (abs(e2-rtop_g2)/rtop_g2 < 0.0075) and (abs(e4-rtop_g2)/rtop_g2 < 0.0075) and \
             (max(e1, e3, e5) > min(e2, e4)):
             patterns['RBOT'].append((window.index[0], window.index[-1]))
     return patterns

迭代DataFrame中的條目,同時(shí)考慮5個(gè)數(shù)據(jù)點(diǎn)。確定每個(gè)5點(diǎn)窗口的模式是否在36天內(nèi)發(fā)生。如果沒(méi)有,則進(jìn)入到下一個(gè)窗口。我們這里有幾種類型的技術(shù)分析圖表模式:

Head and Shoulders(頭肩頂):

這是一種反轉(zhuǎn)圖表模式,通常表示股價(jià)在漲勢(shì)中即將反轉(zhuǎn)。它包括一個(gè)中間峰(頭)和兩個(gè)較低的峰(肩),形成一個(gè)上升趨勢(shì)的結(jié)束信號(hào)。

Inverse Head and Shoulders(倒頭肩底):

與頭肩頂相反,這是一種底部反轉(zhuǎn)圖表模式。它包括一個(gè)中間洼地(倒頭)和兩個(gè)較低的洼地(倒肩),形成一個(gè)下降趨勢(shì)的結(jié)束信號(hào)。

Broadening Top(擴(kuò)頂形態(tài)):

這是一種表示不穩(wěn)定市場(chǎng)的圖表模式,由兩個(gè)趨勢(shì)線分散開(kāi)來(lái)形成。它可能表示市場(chǎng)波動(dòng)性增加,預(yù)示價(jià)格的不確定性。

Broadening Bottom(擴(kuò)底形態(tài)):

與擴(kuò)頂形態(tài)相反,這是一種表示不穩(wěn)定市場(chǎng)的圖表模式,由兩個(gè)趨勢(shì)線逐漸匯聚。它可能表示市場(chǎng)波動(dòng)性增加,預(yù)示價(jià)格的不確定性。

Triangle Top(三角形頂部):

這是一種形成在上升趨勢(shì)中的圖表模式,由兩個(gè)趨勢(shì)線收斂形成三角形。它可能表示價(jià)格即將下降。

Triangle Bottom(三角形底部):

與三角形頂部相反,這是一種形成在下降趨勢(shì)中的圖表模式,由兩個(gè)趨勢(shì)線收斂形成三角形。它可能表示價(jià)格即將上升。

Rectangle Top(矩形頂部):

這是一種在上升趨勢(shì)中形成的圖表模式,由水平線形成一個(gè)矩形。它表示市場(chǎng)可能經(jīng)歷一段橫盤整理,價(jià)格可能會(huì)下跌。

Rectangle Bottom(矩形底部):

與矩形頂部相反,這是一種在下降趨勢(shì)中形成的圖表模式,由水平線形成一個(gè)矩形。它表示市場(chǎng)可能經(jīng)歷一段橫盤整理,價(jià)格可能會(huì)上升。

上面的這些模式是根據(jù)這些局部最大值和最小值的相對(duì)位置和值來(lái)識(shí)別的,檢測(cè)到的每個(gè)模式都存儲(chǔ)在一個(gè)字典中,模式名稱作為鍵,窗口的開(kāi)始和結(jié)束索引作為值。這些索引元組存儲(chǔ)在每個(gè)模式末尾的字典中。

這樣的代碼在算法交易中很有用,當(dāng)它自動(dòng)檢測(cè)與某些市場(chǎng)行為相關(guān)的歷史模式時(shí),允許交易者根據(jù)這些模式的存在做出明智的決策。

patterns = find_patterns(max_min)
 patterns

可視化

上面這些專有名字可能不太容易理解,所以我們可以使用代碼把它們進(jìn)行可視化

def visualize_patterns(dates, prices, smooth_prices, 
                        smooth_prices_max_indices, smooth_prices_min_indices, 
                        price_max_indices, price_min_indices, 
                        patterns, shorthand_fullname_dict):
     for name, end_day_nums in patterns.items():
         print('Pattern Identified: {} \nNumber of Observations: {}'.format(shorthand_fullname_dict[name], len(end_day_nums)))
         rows = int(np.ceil(len(end_day_nums)/2))
         fig, axes = plt.subplots(rows, 2, figsize=(20,5*rows), dpi=200)
         fig.subplots_adjust(hspace=0.5)
         axes = axes.flatten()
         i = 0
         for start_date, end_date in end_day_nums:
             plot_window(dates, prices, smooth_prices, 
                 smooth_prices_max_indices, smooth_prices_min_indices,
                 price_max_indices, price_min_indices, 
                 start=start_date-1, end=end_date+1, ax=axes[i])
             i += 1
         plt.show()
 visualize_patterns(dates, prices, smooth_prices, 
                        smooth_prices_max_indices, smooth_prices_min_indices, 
                        price_max_indices, price_min_indices, 
                        patterns, shorthand_fullname_dict)

可以看到各種模式是不一樣的,這對(duì)我們這些剛?cè)腴T金融行業(yè)的人來(lái)說(shuō)更容易理解。通過(guò)圖形化分析股票價(jià)格走勢(shì)和算法識(shí)別模式的工具,可以有助于我們更直觀地理解市場(chǎng)行為隨著時(shí)間的推移,這對(duì)算法交易至關(guān)重要。

以上就是使用Python代碼識(shí)別股票價(jià)格圖表模式實(shí)現(xiàn)的詳細(xì)內(nèi)容,更多關(guān)于Python識(shí)別股票價(jià)格圖表模式的資料請(qǐng)關(guān)注腳本之家其它相關(guān)文章!

相關(guān)文章

  • Python代碼實(shí)現(xiàn)PDF與Word之間互轉(zhuǎn)

    Python代碼實(shí)現(xiàn)PDF與Word之間互轉(zhuǎn)

    這篇文章主要介紹了如何使用Python的pdf2docx和win32com庫(kù)進(jìn)行PDF與DOCX之間的轉(zhuǎn)換,包括單個(gè)文件和批量文件的處理,文中的示例代碼講解詳細(xì),有需要的小伙伴可以了解下
    2026-03-03
  • Python實(shí)現(xiàn)圖片自定義裁剪小工具

    Python實(shí)現(xiàn)圖片自定義裁剪小工具

    這篇文章主要給大家介紹了利用Python實(shí)現(xiàn)的圖片裁剪小工具,可以實(shí)現(xiàn)將圖片按照自定義尺寸進(jìn)行裁剪,感興趣的小伙伴可以動(dòng)手自己試一試
    2022-01-01
  • Python批量合并PDF文件的方法詳解

    Python批量合并PDF文件的方法詳解

    這篇文章主要為大家詳細(xì)介紹了如何使用Python批量合并PDF文件,文中的示例代碼講解詳細(xì),具有一定的借鑒價(jià)值,有需要的小伙伴可以了解下
    2026-03-03
  • python 生成器協(xié)程運(yùn)算實(shí)例

    python 生成器協(xié)程運(yùn)算實(shí)例

    下面小編就為大家?guī)?lái)一篇python 生成器協(xié)程運(yùn)算實(shí)例。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2017-09-09
  • Python排序算法之冒泡排序

    Python排序算法之冒泡排序

    我們?cè)诰帉懘a時(shí),經(jīng)常需要對(duì)一些序列做一些排序,排序的方法很多,下面我們講一下常用的冒泡排序法。需要的朋友可以參考下
    2023-01-01
  • Pandas操作CSV文件的讀寫實(shí)現(xiàn)方法

    Pandas操作CSV文件的讀寫實(shí)現(xiàn)方法

    這篇文章主要介紹了Pandas操作CSV文件的讀寫實(shí)現(xiàn)方法,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2019-11-11
  • YOLOv5改進(jìn)之添加CBAM注意力機(jī)制的方法

    YOLOv5改進(jìn)之添加CBAM注意力機(jī)制的方法

    注意力機(jī)制最先被用在NLP領(lǐng)域,Attention就是為了讓模型認(rèn)識(shí)到數(shù)據(jù)中哪一部分是最重要的,為它分配更大的權(quán)重,獲得更多的注意力在一些特征上,讓模型表現(xiàn)更好,這篇文章主要給大家介紹了關(guān)于YOLOv5改進(jìn)之添加CBAM注意力機(jī)制的相關(guān)資料,需要的朋友可以參考下
    2022-11-11
  • Python?os?模塊與路徑從基礎(chǔ)到實(shí)戰(zhàn)應(yīng)用

    Python?os?模塊與路徑從基礎(chǔ)到實(shí)戰(zhàn)應(yīng)用

    本文詳解Python中os模塊與路徑處理,涵蓋目錄創(chuàng)建、遍歷、刪除及文件操作,提供日志管理、數(shù)據(jù)備份等實(shí)戰(zhàn)案例,強(qiáng)調(diào)跨平臺(tái)兼容與異常處理最佳實(shí)踐,本文結(jié)合實(shí)例代碼給大家介紹的非常詳細(xì),感興趣的朋友跟隨小編一起看看吧
    2025-08-08
  • python數(shù)據(jù)結(jié)構(gòu)之線性表的順序存儲(chǔ)結(jié)構(gòu)

    python數(shù)據(jù)結(jié)構(gòu)之線性表的順序存儲(chǔ)結(jié)構(gòu)

    這篇文章主要為大家詳細(xì)介紹了python數(shù)據(jù)結(jié)構(gòu)之線性表的順序存儲(chǔ)結(jié)構(gòu),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2018-09-09
  • python回溯算法實(shí)現(xiàn)全排列小練習(xí)分享

    python回溯算法實(shí)現(xiàn)全排列小練習(xí)分享

    這篇文章主要給大家分享的是python回溯算法實(shí)現(xiàn)全排列小練習(xí),文章根據(jù)例子:輸入列表L(不含重復(fù)元素),輸出L的全排列展開(kāi)學(xué)習(xí),需要的小伙伴可以參考一下
    2022-02-02

最新評(píng)論

城市| 柯坪县| 石嘴山市| 灌云县| 女性| 四川省| 印江| 普兰店市| 钟祥市| 永寿县| 莱阳市| 罗甸县| 宁南县| 五华县| 紫金县| 宜昌市| 上虞市| 明水县| 临江市| 太保市| 石渠县| 墨脱县| 策勒县| 宜城市| 浦东新区| 武义县| 沈阳市| 石棉县| 云浮市| 张家港市| 赤峰市| 东山县| 晋州市| 诸暨市| 遂宁市| 玛纳斯县| 承德市| 文昌市| 定州市| 铁岭县| 化隆|