先知模型 facebook_Facebook先知

先知模型 facebook

什么是先知? (What is Prophet?)

“Prophet” is an open-sourced library available on R or Python which helps users analyze and forecast time-series values released in 2017. With developers’ great efforts to make the time-series data analysis be available without expert works, it is highly user-friendly but still highly customizable, even to non-expert users. How lovely!!

“ Prophet”是可在R或Python上使用的開源庫,可幫助用戶分析和預測2017年發布的時間序列值。由于開發人員的巨大努力,使得無需專家工作即可進行時間序列數據分析,用戶友好,但仍然高度可定制,甚至對非專業用戶也是如此。 多么可愛!!

In this article, starting from default model run, I tried to summarize any available tuning options, particularly useful ones, to provide better prediction, although it may not be literally everything because there are so many customizable options in Prophet! I also gave some Python example codes and cheat sheet-like exhibits.

在本文中,從默認模型運行開始,我試圖總結任何可用的調整選項,尤其是有用的調整選項,以提供更好的預測,盡管由于Prophet中有許多可自定義的選項,所以它可能并不是全部內容! 我還給出了一些Python示例代碼和類似備忘單的展覽。

Image for post
Photo by Jake Hills on Unsplash
杰克·希爾斯 ( Jake Hills)在Unsplash上攝

目錄: (Table of Contents:)

-具有默認選項設置的快速入門代碼(在Python中) (- Quick Start Code (in Python) with Default Option Setting)

-先知選項備忘單和使用示例 (- Prophet Options Cheat Sheets And Use Examples)

  • Uncertainty Options / Trend Options / Holiday Options

    不確定性選項/趨勢選項/假日選項
  • Seasonality Options

    季節性選項
  • Adding Regressors / Model Diagnostics

    添加回歸器/模型診斷

-先知的背景數學 (- Background Math of Prophet)

-先知不做的事 (- What Prophet Does Not Do)

  • Prophet does not allow non-Gaussian noise distribution (at the moment)

    先知不允許(此時)非高斯噪聲分布
  • Prophet does not take autocorrelation on residual into account

    先知不考慮殘差的自相關
  • Prophet does not assume stochastic trend

    先知不假設隨機趨勢

-尾注 (- End Note)

具有默認選項設置的快速入門代碼(在Python中) (Quick Start Code (in Python) with Default Option Setting)

Prophet can handle;

先知可以應付;

  • trend with its changepoints,

    趨勢及其變化點,
  • seasonality (yearly, weekly, daily, and other user-defined seasonality),

    季節性(每年,每周,每天和其他用戶定義的季節性),
  • holiday effect, and

    假期效應,以及
  • input regressors

    輸入回歸

as model components, and there’s also uncertainty options to control the prediction uncertainty interval.

作為模型的組成部分,還有不確定性選項來控制預測不確定性間隔。

Here’s what Prophet default functions provide to each of the components.

這是Prophet默認功能提供給每個組件的功能。

Image for post
Default option setup of Prophet
先知的默認選項設置

Below is a quick-start Python code, with default setups.

以下是具有默認設置的快速入門Python代碼。

You may find everything is prepared to be user-friendly without any special care about the time-series data handling. Once you are familiar with basic Python data modeling using sklearn APIs, Prophet code should also look similar.

您可能會發現所有內容都易于使用,無需對時間序列數據處理進行任何特別護理。 熟悉使用sklearn API的基本Python數據建模后,Prophet代碼也應該看起來相似。

Data used in the exercise throughout this post is the data of log-transformed daily page views of the Wikipedia page for Peyton Manning, an American Football player, prepared and distributed by Prophet team.

在本博文中,練習中使用的數據是先知團隊準備和分發的,美國足球運動員佩頓·曼寧 ( Peyton Manning)維基百科頁面上日志轉換后的每日頁面瀏覽量數據。

import pandas as pd
import matplotlib.pyplot as pltfrom fbprophet import Prophet# Load test data: log-transformed daily page views for the Wikipedia page for Peyton Manning.
df = pd.read_csv("https://raw.githubusercontent.com/facebook/prophet/master/examples/example_wp_log_peyton_manning.csv")# Model fit
m = Prophet() #Instanticate from Prophet class. 
m.fit(df) # Fit the Prophet model.# Predict
future = m.make_future_dataframe(periods=365) # Make future date data frame for the next 365 days (it gives daily because it follows the frequency in input dataframe by default).
forecast = m.predict(future) # Predict future value.# Plot results
fig1 = m.plot(forecast) # Plot the fit to past data and future forcast.
fig2 = m.plot_components(forecast) # Plot breakdown of components.
plt.show()
forecast # Displaying various results in table format.

What I like here particularly is “make_future_dateframe” function because making a dataset for future prediction in time-series analysis is usually unpleasant moment because it requires datetime handling. Here with Prophet, just giving the length of future period will provide you the necessary dataframe.

我在這里特別喜歡的是“ make_future_dateframe”函數,因為為時序分析中的將來預測生成數據集通常是不愉快的時刻,因為它需要日期時間處理。 在先知的幫助下,只要給出未來的時長即可為您提供必要的數據框。

Here’s the set of output plots I got from the code.

這是我從代碼中獲得的一組輸出圖。

Image for post
Default code output plot
默認代碼輸出圖
Image for post
Dataframe ‘forecast’ with many predicted components
具有許多預測成分的數據幀“預測”

先知選項備忘單和使用示例 (Prophet Options Cheat Sheets And Use Examples)

不確定性選項/趨勢選項/假日選項 (Uncertainty Options / Trend Options / Holiday Options)

There are options to control uncertainty, trend (type (or mode), changepoint, and visualization), and holiday effect (country or user-input). Here’s a summary:

有一些選項可控制不確定性,趨勢(類型(或模式),變更點和可視化)和假日影響(國家或用戶輸入)。 總結如下:

Image for post
Uncertainty Options / Trend Options / Holiday Options
不確定性選項/趨勢選項/假日選項

Also, here’s a Python code example with the use of some of the options.

另外,這是一個使用某些選項的Python代碼示例。

import pandas as pd
import matplotlib.pyplot as pltfrom fbprophet import Prophet
from fbprophet.plot import add_changepoints_to_plot# Load test data: log-transformed daily page views for the Wikipedia page for Peyton Manning.
df = pd.read_csv("https://raw.githubusercontent.com/facebook/prophet/master/examples/example_wp_log_peyton_manning.csv")
df['cap'] = 10 # Saturating maximum
df['floor'] = 7 # Saturating minimum# Model setup
m = Prophet(growth='logistic')
m.add_country_holidays(country_name='US') # Adding US holiday regressor
m.fit(df) # Future data generation
future = m.make_future_dataframe(periods=365*5)
future['cap'] = 10 # Saturating maximum
future['floor'] = 7 # Saturating minimum# Future forecast
forecast = m.predict(future) # Visualize
fig1 = m.plot(forecast) # Plot the fit to past data and future forcast.
a = add_changepoints_to_plot(fig1.gca(), m, forecast)
fig2 = m.plot_components(forecast) # Plot breakdown of components.
plt.show()

You can see the plot now has the trade changepoints information, and the trade follow the logistic curve having floor and cap, although I don’t think it is reasonable to apply logistic trend for the data after log-transformation. See the component plots now also show the holiday effect.

您可以看到該圖現在具有交易變更點信息,并且交易遵循具有下限和上限的邏輯曲線,盡管我認為對數轉換后對數據應用邏輯趨勢并不合理。 現在查看組件圖也顯示了假日效果。

Image for post
Results of the code
代碼結果

季節性選項 (Seasonality Options)

There are a lot of options in Prophet to control seasonality. Yearly, weekly, and daily seasonality and their granularity; mode of seasonality (additive/multiplicative); user-defined seasonality including conditional seasonality.

先知有很多選擇來控制季節性。 每年,每周和每天的季節性及其粒度; 季節性模式(加法/乘法); 用戶定義的季節性,包括有條件的季節性。

Image for post
Seasonality Options
季節性選項

Here’s an example using conditional weekly seasonality.

這是一個使用有條件的每周季節性的示例。

import pandas as pd
import matplotlib.pyplot as pltfrom fbprophet import Prophet
from fbprophet.plot import add_changepoints_to_plot# Load test data: log-transformed daily page views for the Wikipedia page for Peyton Manning.
df = pd.read_csv("https://raw.githubusercontent.com/facebook/prophet/master/examples/example_wp_log_peyton_manning.csv")def is_nfl_season(ds):date = pd.to_datetime(ds)return (date.month > 8 or date.month < 2)df['on_season'] = df['ds'].apply(is_nfl_season) #on_season dummy.
df['off_season'] = ~df['ds'].apply(is_nfl_season) #off_season dummy.# set user-defined seasonality and fit
m = Prophet(weekly_seasonality=False)
m.add_seasonality(name='weekly_on_season', period=7, fourier_order=3, condition_name='on_season')
m.add_seasonality(name='weekly_off_season', period=7, fourier_order=3, condition_name='off_season')
m.fit(df)# Make the same columns to future data.
future = m.make_future_dataframe(periods=365*5) # Make future date data frame for the next 365 days (it gives daily because it follows the frequency in input dataframe by default).
future['on_season'] = future['ds'].apply(is_nfl_season)
future['off_season'] = ~future['ds'].apply(is_nfl_season)# Predict future value.
forecast = m.predict(future)# Plot results
fig1 = m.plot(forecast) # Plot the fit to past data and future forcast.
a = add_changepoints_to_plot(fig1.gca(), m, forecast)
fig2 = m.plot_components(forecast) # Plot breakdown of components.
plt.show()

You can find the on-season weekly seasonality and off-season weekly seasonality are also plotted (and look very different, which indicates they worth splitting.)

您會發現還繪制了季節的每周季節性和季節的每周季節性(并且看起來非常不同,表明它們值得拆分)。

Image for post
Result of the code
代碼結果

添加回歸器/模型診斷 (Adding Regressors / Model Diagnostics)

Prophet also allow to input regressors (or explanatory variables, or features). Just adding columns to input data and future data and tell the model about them using ‘add_regressor’.

先知還允許輸入回歸變量(或解釋變量或特征)。 只需在輸入數據和將來的數據中添加列,然后使用“ add_regressor”將其告知模型。

Image for post
https://www.researchgate.net/figure/Forecast-on-a-rolling-origin-cross-validation_fig1_326835034); blue=training set, orange=validation sethttps://www.researchgate.net/figure/Forecast-on-a-rolling-origin-cross-validation_fig1_326835034 ); 藍色=訓練集,橙色=驗證集

Last but not the least, Prophet has many useful functionality to do model diagnostics, cross-validation in a way of “rolling origin” (see picture on the left), and output of performance metrics.

最后但并非最不重要的一點是,Prophet具有許多有用的功能,可以進行模型診斷,以“滾動原點”的方式進行交叉驗證(參見左圖)以及性能指標的輸出。

Image for post
Adding Regressors / Model Diagnostics
添加回歸器/模型診斷

Here’s an example using cross-validation option.

這是使用交叉驗證選項的示例。

import pandas as pd
import matplotlib.pyplot as plt
from IPython.display import displayfrom fbprophet import Prophet
from fbprophet.diagnostics import cross_validation, performance_metrics
from fbprophet.plot import add_changepoints_to_plot, plot_cross_validation_metric# Load test data: log-transformed daily page views for the Wikipedia page for Peyton Manning.
df = pd.read_csv("https://raw.githubusercontent.com/facebook/prophet/master/examples/example_wp_log_peyton_manning.csv")m = Prophet()
m.fit(df)# Execute cross validation
df_cv = cross_validation(m, initial='730 days', period='180 days', horizon = '365 days')
pm = performance_metrics(df_cv, rolling_window=0.1)
display(pm.head(),pm.tail())
fig = plot_cross_validation_metric(df_cv, metric='mape', rolling_window=0.1)
plt.show()

Here are what we get from the codes. 6 different types of metrics are shown by each time horizon, but by taking moving average over 37 days in this case (can be changed by ‘rolling_window’ option).

這是我們從代碼中得到的。 每個時間范圍都會顯示6種不同類型的指標,但是在這種情況下,可以采用37天的移動平均值(可以通過“ rolling_window”選項進行更改)。

The metrics can be also plotted so that you can check visually how things change over the time horizons.

還可以繪制度量標準,以便您可以直觀地檢查時間范圍內事物的變化。

Image for post
Results of the code
代碼結果

先知的背景數學 (Background Math of Prophet)

Math in Prophet is well-discussed in their paper “Forecasting at Scale” or other Medium articles.

先知數學在他們的論文“大規模預測”或其他Medium文章中得到了充分討論。

Based on “Forecasting at Scale” and their model in the Prophet module, the main formula of the model is described as follows:

基于Prophet模塊中的“大規模預測”及其模型,模型的主要公式描述如下:

Image for post

, where

,在哪里

Image for post

Respectively,

分別,

Image for post
Trend portion
趨勢部分
Image for post
Seasonality portion
季節性部分
Image for post
Holiday effect portion
假期效果部分

I will not talk too much about the details of the formula here, just recommend reading their paper “Forecasting at Scale” once for more details.

在這里,我不會過多地討論公式的詳細信息,只建議閱讀他們的論文“大規模預測”以獲取更多詳細信息。

Any parameters are inferred using MCMC simulated on Stan — MAP estimate (Newton method or L-BFGS) or sampling depending on ‘mcmc_samples’ option.

使用在Stan — MAP估計(牛頓法或L-BFGS)上模擬的MCMC或根據“ mcmc_samples”選項進行采樣可以推斷出任何參數。

先知不做什么 (What Prophet Does Not Do)

先知不允許(此時)非高斯噪聲分布 (Prophet does not allow non-Gaussian noise distribution (at the moment))

In Prophet, noise distribution is always Gaussian and pre-transformation of y values is the only way to handle the values following skewed distribution.

在先知中,噪聲分布始終是高斯分布,并且y值的預轉換是處理傾斜分布后的值的唯一方法。

This is a topic actively discussed in one of issues of the Prophet GitHub repository here and possible code customization to allow Poisson and Negative Binomial distribution in case the target value is a count data was given in the discussion.

這是在此處的Prophet GitHub存儲庫中的一個問題中積極討論的主題,并且可能的代碼自定義以允許Poisson和負二項式分布,以防在討論中給出目標值為計數數據的情況。

先知不考慮殘差的自相關 (Prophet does not take autocorrelation on residual into account)

Since epsilon noise portion in the formula assume i.i.d. normal distribution, the residual is not assumed to have autocorrelation, unlike ARIMA model.

由于公式中的ε噪聲部分呈正態分布,因此與ARIMA模型不同,殘差不具有自相關性。

Actually, when we plot the ACF and PACF after the fit of Peyton Manning data, we will see clear AR(1) tendency — exponentially decaying ACF, high PACF at t=1 and close to zero PACF at t≥2.

實際上,當我們根據Peyton Manning數據擬合繪制ACF和PACF時,將看到清晰的AR(1)趨勢-ACF呈指數衰減,t = 1時PACF高,t≥2時PACF接近零。

# After getting forecast dataframe using user-defined seasonality "on-season"/"off-season" above...from statsmodels.graphics.tsaplots import plot_pacf, plot_acfdf['ds'] = pd.to_datetime(df['ds'],format='%Y-%m-%d')
df_res = df.merge(forecast,how="inner",on="ds")
df_res['residual'] = df_res['y'] - df_res['yhat']
plot_acf(df_res['residual'])
plot_pacf(df_res['residual'])
plt.show()
Image for post

And, when I created a new data frame having lagged value and tested to add it as a regressor just like manually prepared AR(1) model, the ACF and PACF indicated the white noise’s ones, although this approach is not implemented in the Prophet therefore unable to give future prediction in a regular use of the Prophet functions.

而且,當我創建一個具有滯后值的新數據幀并像手動準備的AR(1)模型一樣進行測試以將其添加為回歸變量時,ACF和PACF會指示白噪聲,盡管先知沒有實現此方法。無法定期使用先知函數給出未來的預測

Image for post
‘y_lag’ is to represent y value in prior time stamp.
“ y_lag”表示先前時間戳中的y值。
Image for post
Adding y_lag as regressor looks giving WN residuals.
將y_lag添加為回歸值看起來會得到WN殘差。

This topic is discussed in one of the issues of the Prophet GitHub repository here. An interesting idea from Ben Letham about MA(1) case was to use the prior time point’s residual for a regressor of next time point value. Since we do not know the true value of residual until we fit the true model, the estimation would be iterative, something like boosting. Again, in this approach the future prediction can not be given by the regular use of Prophet functions.

在此處的Prophet GitHub存儲庫中的一個問題中討論了此主題。 本·萊瑟姆(Ben Letham)關于MA(1)情況的一個有趣想法是將先前時間點的殘差用于下一時間點值的回歸。 由于在擬合真實模型之前,我們不知道殘差的真實值,因此估算將是迭代的,類似于增強。 同樣,在這種方法中,無法通過常規使用先知函數來給出未來的預測。

先知不假設隨機趨勢 (Prophet does not assume stochastic trend)

Prophet’s trend component is always deterministic+possible changepoints and it won’t assume stochastic trend unlike ARIMA. See this web page for the discussion of ‘stochastic trend vs. deterministic trend’.

先知的趨勢成分始終是確定性+可能的變化點,并且不會像ARIMA那樣假設隨機趨勢。 請參閱此網頁 ,以了解“隨機趨勢與確定性趨勢”。

Usually, we do unit root tests to know if the data is stationary or trend stationary. When rejected, we do differencing the data until we know the data is stationary, which also give stochastic trend component. Using deterministic trend (without changepoints) underestimates the uncertainty compared to stochastic trend, although Prophet looks using changepoints components and its future uncertainty to cover up that underestimate.

通常,我們進行單位根檢驗以了解數據是平穩的還是趨勢平穩的。 當被拒絕時,我們將對數據進行差異化處理,直到我們知道數據是固定的為止,這也將給出隨機趨勢分量。 與隨機趨勢相比,使用確定性趨勢(無變化點)會低估不確定性,盡管先知似乎使用變化點成分及其未來的不確定性來掩蓋這一低估。

尾注 (End Note)

Prophet has high usability with many customizable options to handle most of the necessary extensions to model the time-series data. It is well-modularized as one package so that users can enjoy them without embarrassing exposure to the math of the model.

Prophet具有很高的可用性,具有許多可自定義的選項,可以處理大多數必要的擴展,以對時間序列數據進行建模。 它作為一個組件進行了很好的模塊化,因此用戶可以在不尷尬地接觸模型數學的情況下享受它們。

Model itself is based on simple building blocks of separate components of the effects. Those effects are estimated by MCMC on Stan. This simplicity gives high visibility to each effect and should provide a great basis of discussion between experts and non-experts, although it somewhat sacrifices some of time-series modeling considerations, which are beyond the ‘building block’ approach, such as autocorrelation or stochastic trend.

模型本身基于效果的獨立組件的簡單構建塊。 MCMC對Stan估計了這些影響。 這種簡單性使每種效果都具有很高的可視性,并且應該為專家和非專家之間的討論提供良好的基礎,盡管它在某種程度上犧牲了一些時間序列建模方面的考慮,這超出了“構建模塊”方法的范圍,例如自相關或隨機性。趨勢。

翻譯自: https://medium.com/swlh/facebook-prophet-426421f7e331

先知模型 facebook

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/390891.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/390891.shtml
英文地址,請注明出處:http://en.pswp.cn/news/390891.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

Java里面的靜態代碼塊

問題&#xff1a;Java里面的靜態代碼塊 I was looking over some code the other day and I came across: 前幾天我在看一些代碼時發現&#xff1a; static {... }我是c轉來的&#xff0c;我不知道為啥要這樣干。這個代碼也編譯成功了&#xff0c;沒出錯誤。這里的"stat…

搭建Maven私服那點事

摘要&#xff1a;本文主要介紹在CentOS7.1下使用nexus3.6.0搭建maven私服&#xff0c;以及maven私服的使用&#xff08;將自己的Maven項目指定到私服地址、將第三方項目jar上傳到私服供其他項目組使用&#xff09; 一、簡介 Maven是一個采用純Java編寫的開源項目管理工具, Mave…

lee最短路算法_Lee算法的解釋:迷宮運行并找到最短路徑

lee最短路算法Lee算法是什么&#xff1f; (What is the Lee Algorithm?) The Lee algorithm is one possible solution for maze routing problems. It always gives an optimal solution, if one exists, but is slow and requires large memory for dense layout.Lee算法是迷…

gan訓練失敗_我嘗試過(但失敗了)使用GAN來創作藝術品,但這仍然值得。

gan訓練失敗This work borrows heavily from the Pytorch DCGAN Tutorial and the NVIDA paper on progressive GANs.這項工作大量借鑒了Pytorch DCGAN教程 和 有關漸進式GAN 的 NVIDA論文 。 One area of computer vision I’ve been wanting to explore are GANs. So when m…

怎么樣實現對一個對象的深拷貝

問題&#xff1a;怎么樣實現對一個對象的深拷貝 使用深拷貝的方法有點難實現啊。要保證原來的對象和克隆對象不是共享同一個引用的步驟是什么啊&#xff1f; 回答一 一種安全的方法是先序列化對象&#xff0c;然后反序列化。這保證了所有東西都是一個新的引用。 這里有一篇…

19.7 主動模式和被動模式 19.8 添加監控主機 19.9 添加自定義模板 19.10 處理圖形中的亂碼 19.11 自動發現...

2019獨角獸企業重金招聘Python工程師標準>>> 19.7 主動模式和被動模式 ? 主動或者被動是相對客戶端來講的 ? 被動模式&#xff0c;服務端會主動連接客戶端獲取監控項目數據&#xff0c;客戶端被動地接受連接&#xff0c;并把監控信息傳遞給服務端 服務端請求以后&…

Codeforces Round #444 (Div. 2) C.Solution for Cube 模擬

向題解低頭&#xff0c;向大佬低頭(。﹏。)orz……模擬也不能亂模啊……要好好分析題意&#xff0c;簡化簡化再簡化orz敲黑板 六個面的魔方&#xff0c;能一步還原的情況一定是只有2個面是單色&#xff0c;其余四個面&#xff0c;每個面2種顏色&#xff0c;而且不會出現任意兩面…

fcc認證_介紹fCC 100:我們對2019年杰出貢獻者的年度總結

fcc認證2019 has been a big year for the global freeCodeCamp community.對于全球freeCodeCamp社區來說&#xff0c;2019年是重要的一年。 More people are answering questions on the forum. 越來越多的人在論壇上回答問題。 Our publication has several new, rising aut…

華盛頓特區與其他地區的差別_使用華盛頓特區地鐵數據確定可獲利的廣告位置...

華盛頓特區與其他地區的差別深度分析 (In-Depth Analysis) Living in Washington DC for the past 1 year, I have come to realize how WMATA metro is the lifeline of this vibrant city. The metro network is enormous and well-connected throughout the DMV area. When …

Windows平臺下kafka環境的搭建

近期在搞kafka&#xff0c;在Windows環境搭建的過程中遇到一些問題&#xff0c;把具體的流程幾下來防止后面忘了。 準備工作&#xff1a; 1.安裝jdk環境 http://www.oracle.com/technetwork/java/javase/downloads/index.html 2.下載kafka的程序安裝包&#xff1a; http://kafk…

deeplearning.ai 改善深層神經網絡 week2 優化算法

這一周的主題是優化算法。 1. Mini-batch&#xff1a; 上一門課討論的向量化的目的是去掉for循環加速優化計算&#xff0c;X [x(1) x(2) x(3) ... x(m)]&#xff0c;X的每一個列向量x(i)是一個樣本&#xff0c;m是樣本個數。但當樣本很多時&#xff08;比如m500萬&#xff09…

gcc匯編匯編語言_什么是匯編語言?

gcc匯編匯編語言Assembly Language is the interface between higher level languages (C, Java, etc) and machine code (binary). For a compiled language, the compiler transforms higher level code into assembly language code.匯編語言是高級語言(C &#xff0c;Java等…

鋪裝s路畫法_數據管道的鋪裝之路

鋪裝s路畫法Data is a key bet for Intuit as we invest heavily in new customer experiences: a platform to connect experts anywhere in the world with customers and small business owners, a platform that connects to thousands of institutions and aggregates fin…

leetcode421. 數組中兩個數的最大異或值(貪心算法)

給你一個整數數組 nums &#xff0c;返回 nums[i] XOR nums[j] 的最大運算結果&#xff0c;其中 0 ≤ i ≤ j < n 。 進階&#xff1a;你可以在 O(n) 的時間解決這個問題嗎&#xff1f; 示例 1&#xff1a; 輸入&#xff1a;nums [3,10,5,25,2,8] 輸出&#xff1a;28 解…

IBM推全球首個5納米芯片:計劃2020年量產

IBM日前宣布&#xff0c;該公司已取得技術突破&#xff0c;利用5納米技術制造出密度更大的芯片。這種芯片可以將300億個5納米開關電路集成在指甲蓋大小的芯片上。 IBM推全球首個5納米芯片 IBM表示&#xff0c;此次使用了一種新型晶體管&#xff0c;即堆疊硅納米板&#xff0c;將…

drop sql語句_用于從表中刪除數據SQL Drop View語句

drop sql語句介紹 (Introduction) This guide covers the SQL statement for dropping (deleting) one or more view objects.本指南介紹了用于刪除(刪除)一個或多個視圖對象SQL語句。 A View is an object that presents data from one or more tables.視圖是顯示來自一個或多…

async 和 await的前世今生 (轉載)

async 和 await 出現在C# 5.0之后&#xff0c;給并行編程帶來了不少的方便&#xff0c;特別是當在MVC中的Action也變成async之后&#xff0c;有點開始什么都是async的味道了。但是這也給我們編程埋下了一些隱患&#xff0c;有時候可能會產生一些我們自己都不知道怎么產生的Bug&…

項目案例:qq數據庫管理_2小時元項目:項目管理您的數據科學學習

項目案例:qq數據庫管理Many of us are struggling to prioritize our learning as a working professional or aspiring data scientist. We’re told that we need to learn so many things that at times it can be overwhelming. Recently, I’ve felt like there could be …

react 示例_2020年的React Cheatsheet(+真實示例)

react 示例Ive put together for you an entire visual cheatsheet of all of the concepts and skills you need to master React in 2020.我為您匯總了2020年掌握React所需的所有概念和技能的完整視覺摘要。 But dont let the label cheatsheet fool you. This is more than…

leetcode 993. 二叉樹的堂兄弟節點

在二叉樹中&#xff0c;根節點位于深度 0 處&#xff0c;每個深度為 k 的節點的子節點位于深度 k1 處。 如果二叉樹的兩個節點深度相同&#xff0c;但 父節點不同 &#xff0c;則它們是一對堂兄弟節點。 我們給出了具有唯一值的二叉樹的根節點 root &#xff0c;以及樹中兩個…