五、線性回歸和多項式回歸實現

官網API

一、線性回歸

針對的是損失函數loss faction

Ⅰ、Lasso Regression

采用L1正則,會使得w值整體偏小;w會變小從而達到降維的目的
在這里插入圖片描述

import numpy as np
from sklearn.linear_model import Lasso
from sklearn.linear_model import SGDRegressorX = 2 * np.random.rand(100, 1)
y = 4 + 3 * X + np.random.randn(100, 1)lasso_reg = Lasso(alpha=0.15, max_iter=10000)
lasso_reg.fit(X, y)
print("w0=",lasso_reg.intercept_)
print("w1=",lasso_reg.coef_)sgd_reg = SGDRegressor(penalty='l1', max_iter=10000)
sgd_reg.fit(X, y.ravel())
print("w0=",sgd_reg.intercept_)
print("w1=",lasso_reg.coef_)

Ⅱ、Ridge Regression(嶺回歸)

采用L2正則,會使得有的w趨近1,有的w趨近0;當w趨近于0的時候,相對于可以忽略,w會變少也可以達到降維的目的(深度學習模型建立首選
在這里插入圖片描述

import numpy as np
from sklearn.linear_model import Ridge
from sklearn.linear_model import SGDRegressor#隨機梯度下降回歸#模擬數據
X = 2 * np.random.rand(100,1)
y = 4 + 3 * X + np.random.randn(100,1)ridge_reg = Ridge(alpha=1,solver='auto')#創建一個ridge回歸模型實例,alpha為懲罰項前的系數
ridge_reg.fit(X,y)
print("w0=",ridge_reg.intercept_)#w0
print("w1=",ridge_reg.coef_)#w1sgd_reg = SGDRegressor(penalty='l2')
sgd_reg.fit(X,y.ravel())
print("w0=",sgd_reg.intercept_)#w0
print("w1=",sgd_reg.coef_)#w1

Ⅲ、Elastic Net回歸

當你不清楚使用L1正則化還是L2正則化的時候,可以采用Elastic Net
在這里插入圖片描述

import numpy as np
from sklearn.linear_model import ElasticNet
from sklearn.linear_model import SGDRegressorX = 2 * np.random.rand(100, 1)
y = 4 + 3 * X + np.random.randn(100, 1)elastic_net = ElasticNet(alpha=0.0001, l1_ratio=0.15)
elastic_net.fit(X, y)
#print(elastic_net.predict(1.5))
print("w0=",elastic_net.intercept_)
print("w1=",elastic_net.coef_)sgd_reg = SGDRegressor(penalty='elasticnet', max_iter=1000)
sgd_reg.fit(X, y.ravel())
#print(sgd_reg.predict(1.5))
print("w0=",sgd_reg.intercept_)
print("w1=",sgd_reg.coef_)

Ⅳ、總結

①算法選擇順序,Ridge Regression (L2正則化) --> ElasticNet (即包含L1又包含L2) --> Lasso Regression (L1正則化)
②正則化L1和L2有什么區別?

答:L1是w絕對值加和,L2是w平方加和。L1的有趣的現象是會使得w有的接近于0,有的接近于1,
L1更多的會用在降維上面,因為有的是0有的是1,我們也稱之為稀疏編碼。
L2是更常用的正則化手段,它會使得w整體變小

超參數alpha 在Rideg類里面就直接是L2正則的權重
超參數alpha 在Lasso類里面就直接是L1正則的權重
超參數alpha 在ElasticNet和SGDRegressor里面是損失函數里面的alpha
超參數l1_ration 在ElasticNet和SGDRegressor里面是損失函數的p

二、多項式回歸

針對的是數據預處理進行特征處理,跟歸一化一樣,都是針對的是數據
多項式回歸其實是線性回歸的一種拓展。
多項式回歸:叫回歸但并不是去做擬合的算法
PolynomialFeatures是來做預處理的,來轉換我們的數據,把數據進行升維!

import numpy as np
import matplotlib.pyplot as plt
from sklearn.preprocessing import PolynomialFeatures
from sklearn.linear_model import LinearRegression
m = 100#100個樣本
X = 6 * np.random.rand(m, 1) - 3#m行1列的數,數的取值范圍在[-3,3]
y = 0.5 * X ** 2 + X + 2 + np.random.randn(m, 1)plt.plot(X, y, 'b.')

在這里插入圖片描述

d = {1: 'g-', 2: 'r+', 10: 'y*'}
for i in d:poly_features = PolynomialFeatures(degree=i, include_bias=False)#degree超參數可以改變,當然若太大會出現過擬合現象,導致效果更加糟糕X_poly = poly_features.fit_transform(X)print(X[0])print(X_poly[0])print(X_poly[:, 0])lin_reg = LinearRegression(fit_intercept=True)lin_reg.fit(X_poly, y)print(lin_reg.intercept_, lin_reg.coef_)y_predict = lin_reg.predict(X_poly)plt.plot(X_poly[:, 0], y_predict, d[i])plt.show()
"""
[-1.17608282]
[-1.17608282]
[-1.17608282  0.84008756 -0.47456115  1.09332609 -0.08048591  2.56227793-2.16089094  2.9934595  -0.97719578 -0.35093548 -0.01833382 -2.578095490.90594767  1.23236141  0.5809494  -1.03761487  1.07926559 -1.015365042.08713351  1.68679419  0.36108667  0.0739686  -0.60676473 -0.09778250.93322126 -0.98029008  1.80329174 -2.7079627   2.27067075 -0.23098381-2.84414673  2.80368239  1.13965085  0.60386564  1.5068452   0.084835792.54605719  2.25506764 -0.57412233  1.40321778  0.08664762  1.79293147-0.72311264 -1.39573162  0.15066435 -2.56825076  1.6992054   0.306551442.27792527  0.05690445  1.91725839  2.70744724 -0.46459041  1.24513038-0.90932212  2.71793477 -1.64319111  1.49955188  2.17534115 -2.505103912.72835224 -0.17797949 -0.07305404 -0.60531858  0.90754969  0.1864542.63700818  2.00439925 -1.26906332 -0.03326623  0.95249887  2.988010311.39131364 -1.46984234  0.67347918  1.30899516 -0.68746311 -0.078952172.847029   -1.94670177 -0.73970148 -1.05884194 -2.95987324 -2.27319748-0.01555128 -0.86999284  0.45600536  1.21528784 -1.72581767  0.22440468-1.50353748  2.36782931  2.30633509  1.76346603 -0.79567338 -0.061536510.87272525  0.78535366  2.36179793  2.05667417]
[2.99104579] [[1.19669575]]
[-1.17608282]
[-1.17608282  1.38317079]
[-1.17608282  0.84008756 -0.47456115  1.09332609 -0.08048591  2.56227793-2.16089094  2.9934595  -0.97719578 -0.35093548 -0.01833382 -2.578095490.90594767  1.23236141  0.5809494  -1.03761487  1.07926559 -1.015365042.08713351  1.68679419  0.36108667  0.0739686  -0.60676473 -0.09778250.93322126 -0.98029008  1.80329174 -2.7079627   2.27067075 -0.23098381-2.84414673  2.80368239  1.13965085  0.60386564  1.5068452   0.084835792.54605719  2.25506764 -0.57412233  1.40321778  0.08664762  1.79293147-0.72311264 -1.39573162  0.15066435 -2.56825076  1.6992054   0.306551442.27792527  0.05690445  1.91725839  2.70744724 -0.46459041  1.24513038-0.90932212  2.71793477 -1.64319111  1.49955188  2.17534115 -2.505103912.72835224 -0.17797949 -0.07305404 -0.60531858  0.90754969  0.1864542.63700818  2.00439925 -1.26906332 -0.03326623  0.95249887  2.988010311.39131364 -1.46984234  0.67347918  1.30899516 -0.68746311 -0.078952172.847029   -1.94670177 -0.73970148 -1.05884194 -2.95987324 -2.27319748-0.01555128 -0.86999284  0.45600536  1.21528784 -1.72581767  0.22440468-1.50353748  2.36782931  2.30633509  1.76346603 -0.79567338 -0.061536510.87272525  0.78535366  2.36179793  2.05667417]
[1.77398327] [[0.96156952 0.516698  ]]
[-1.17608282]
[-1.17608282  1.38317079 -1.6267234   1.91316143 -2.25003628  2.64622901-3.11218446  3.66018667 -4.30468264  5.06266328]
[-1.17608282  0.84008756 -0.47456115  1.09332609 -0.08048591  2.56227793-2.16089094  2.9934595  -0.97719578 -0.35093548 -0.01833382 -2.578095490.90594767  1.23236141  0.5809494  -1.03761487  1.07926559 -1.015365042.08713351  1.68679419  0.36108667  0.0739686  -0.60676473 -0.09778250.93322126 -0.98029008  1.80329174 -2.7079627   2.27067075 -0.23098381-2.84414673  2.80368239  1.13965085  0.60386564  1.5068452   0.084835792.54605719  2.25506764 -0.57412233  1.40321778  0.08664762  1.79293147-0.72311264 -1.39573162  0.15066435 -2.56825076  1.6992054   0.306551442.27792527  0.05690445  1.91725839  2.70744724 -0.46459041  1.24513038-0.90932212  2.71793477 -1.64319111  1.49955188  2.17534115 -2.505103912.72835224 -0.17797949 -0.07305404 -0.60531858  0.90754969  0.1864542.63700818  2.00439925 -1.26906332 -0.03326623  0.95249887  2.988010311.39131364 -1.46984234  0.67347918  1.30899516 -0.68746311 -0.078952172.847029   -1.94670177 -0.73970148 -1.05884194 -2.95987324 -2.27319748-0.01555128 -0.86999284  0.45600536  1.21528784 -1.72581767  0.22440468-1.50353748  2.36782931  2.30633509  1.76346603 -0.79567338 -0.061536510.87272525  0.78535366  2.36179793  2.05667417]
[1.75155522] [[ 0.96659081  1.47322289 -0.32379381 -1.09309828  0.22053653  0.3517641-0.03986542 -0.04423885  0.00212836  0.00193739]]
"""

在這里插入圖片描述

完整代碼如下:

import numpy as np
import matplotlib.pyplot as plt
from sklearn.preprocessing import PolynomialFeatures
from sklearn.linear_model import LinearRegressionm = 100#100個樣本
X = 6 * np.random.rand(m, 1) - 3#m行1列的數,m = 100#100個樣本
X = 6 * np.random.rand(m, 1) - 3#m行1列的數,數的取值范圍在[-3,3]
y = 0.5 * X ** 2 + X + 2 + np.random.randn(m, 1)plt.plot(X, y, 'b.')#數的取值范圍在[-3,3]
y = 0.5 * X ** 2 + X + 2 + np.random.randn(m, 1)plt.plot(X, y, 'b.')d = {1: 'g-', 2: 'r+', 10: 'y*'}
for i in d:poly_features = PolynomialFeatures(degree=i, include_bias=False)X_poly = poly_features.fit_transform(X)print(X[0])print(X_poly[0])print(X_poly[:, 0])lin_reg = LinearRegression(fit_intercept=True)lin_reg.fit(X_poly, y)print(lin_reg.intercept_, lin_reg.coef_)y_predict = lin_reg.predict(X_poly)plt.plot(X_poly[:, 0], y_predict, d[i])plt.show()

三、案例實戰

保險公司的一份數據集,里面含有多人的age、sex、bmi、children、smoker、region、charges。
年齡、性別、BMI肥胖指數、有幾個孩子、是否吸煙、居住區域、醫療開銷。
很顯然,這是個有監督的學習,保險公司肯定是想通過其他因素來確定處某個人的醫療開銷,來一個人,我可以通過他的年齡、性別、BMI肥胖指數、有幾個孩子、是否吸煙、居住區域來推測出這個人的醫療開銷。
故,這里的y為charges,各因素為age、sex、bmi、children、smoker、region。
在這里插入圖片描述

免費保險公司用戶信息數據集下載,這里采用的是CSV文件,也就是數據之間通過逗號隔開的數據集。
逗號分隔值(Comma-Separated Values,CSV,有時也稱為字符分隔值,因為分隔字符也可以不是逗號)

import pandas as pd
import matplotlib.pyplot as plt
from sklearn.preprocessing import PolynomialFeatures
from sklearn.linear_model import LinearRegression
data = pd.read_csv('./insurance.csv')#該路徑為數據集的路徑
print(type(data))
print(data.head())#輸出前5條數據
print(data.tail())#輸出后5條數據
# describe做簡單的統計摘要
print(data.describe())
"""
<class 'pandas.core.frame.DataFrame'>age     sex     bmi  children smoker     region      charges
0   19  female  27.900         0    yes  southwest  16884.92400
1   18    male  33.770         1     no  southeast   1725.55230
2   28    male  33.000         3     no  southeast   4449.46200
3   33    male  22.705         0     no  northwest  21984.47061
4   32    male  28.880         0     no  northwest   3866.85520age     sex    bmi  children smoker     region     charges
1333   50    male  30.97         3     no  northwest  10600.5483
1334   18  female  31.92         0     no  northeast   2205.9808
1335   18  female  36.85         0     no  southeast   1629.8335
1336   21  female  25.80         0     no  southwest   2007.9450
1337   61  female  29.07         0    yes  northwest  29141.3603age          bmi     children       charges
count  1338.000000  1338.000000  1338.000000   1338.000000
mean     39.207025    30.663397     1.094918  13270.422265
std      14.049960     6.098187     1.205493  12110.011237
min      18.000000    15.960000     0.000000   1121.873900
25%      27.000000    26.296250     0.000000   4740.287150
50%      39.000000    30.400000     1.000000   9382.033000
75%      51.000000    34.693750     2.000000  16639.912515
max      64.000000    53.130000     5.000000  63770.428010
"""
# 采樣要均勻
data_count = data['age'].value_counts()#看看age有多少個不同的年齡,各個年齡的人一共有幾個人
print(data_count)
data_count[:10].plot(kind='bar')#將年齡的前10個進行柱狀圖展示
plt.show()
# plt.savefig('./temp')#可以指定將圖進行保存的路徑
"""
18    69
19    68
51    29
45    29
46    29
47    29
48    29
50    29
52    29
20    29
26    28
54    28
53    28
25    28
24    28
49    28
23    28
22    28
21    28
27    28
28    28
31    27
29    27
30    27
41    27
43    27
44    27
40    27
42    27
57    26
34    26
33    26
32    26
56    26
55    26
59    25
58    25
39    25
38    25
35    25
36    25
37    25
63    23
60    23
61    23
62    23
64    22
Name: age, dtype: int64
"""

在這里插入圖片描述

print(data.corr())
"""age       bmi  children   charges
age       1.000000  0.109272  0.042469  0.299008
bmi       0.109272  1.000000  0.012759  0.198341
children  0.042469  0.012759  1.000000  0.067998
charges   0.299008  0.198341  0.067998  1.000000
"""
reg = LinearRegression()
x = data[['age', 'sex', 'bmi', 'children', 'smoker', 'region']]
y = data['charges']
# python3.6 報錯 sklearn ValueError: could not convert string to float: 'northwest',加入一下幾行解決
x = x.apply(pd.to_numeric, errors='coerce')#有的數據集類型是字符串,需要通過to_numeric方法轉換為數值型
y = y.apply(pd.to_numeric, errors='coerce')
x.fillna(0, inplace=True)#數據集中為空的地方填充為0
y.fillna(0, inplace=True)poly_features = PolynomialFeatures(degree=3, include_bias=False)
X_poly = poly_features.fit_transform(x)reg.fit(X_poly, y)
print("w0=",reg.intercept_)#w0
print("w1=",reg.coef_)#w1
"""
w0= 14959.173791946276
w1= [ 5.86755877e+02 -8.66943361e-09 -2.43090741e+03  2.46877353e+03-2.34731345e-09  6.66457112e-10 -1.20823237e+01  2.22654961e-096.99860524e+00 -1.94583589e+02 -2.67144085e-10  4.64133620e-107.31601446e-11  3.21392690e-10 -1.89132265e-10  7.45785655e-113.91901267e-09  9.19625484e+01 -1.49720497e+02  0.00000000e+000.00000000e+00  2.76208814e+03  0.00000000e+00  0.00000000e+000.00000000e+00  0.00000000e+00  0.00000000e+00  9.96980980e-020.00000000e+00  4.50579510e-02  3.12743917e+00  0.00000000e+000.00000000e+00  0.00000000e+00  0.00000000e+00  0.00000000e+000.00000000e+00  0.00000000e+00 -2.30842696e-01 -1.20554724e+000.00000000e+00  0.00000000e+00 -4.28257797e+00  0.00000000e+000.00000000e+00  0.00000000e+00  0.00000000e+00  0.00000000e+000.00000000e+00  0.00000000e+00  0.00000000e+00  0.00000000e+000.00000000e+00  0.00000000e+00  0.00000000e+00  0.00000000e+000.00000000e+00  0.00000000e+00  0.00000000e+00  0.00000000e+000.00000000e+00  0.00000000e+00  0.00000000e+00 -9.34651320e-015.89748395e+00  0.00000000e+00  0.00000000e+00 -5.02728643e+010.00000000e+00  0.00000000e+00  0.00000000e+00  0.00000000e+000.00000000e+00 -2.25687557e+02  0.00000000e+00  0.00000000e+000.00000000e+00  0.00000000e+00  0.00000000e+00  0.00000000e+000.00000000e+00  0.00000000e+00  0.00000000e+00]
"""
y_predict = reg.predict(X_poly)plt.plot(x['age'], y, 'b.')
plt.plot(X_poly[:, 0], y_predict, 'r.')
plt.show()

在這里插入圖片描述

完整代碼如下:

import pandas as pd
import matplotlib.pyplot as plt
from sklearn.preprocessing import PolynomialFeatures
from sklearn.linear_model import LinearRegressiondata = pd.read_csv('./insurance.csv')
print(type(data))
print(data.head())#輸出前5條數據
print(data.tail())#輸出后5條數據
# describe做簡單的統計摘要
print(data.describe())# 采樣要均勻
data_count = data['age'].value_counts()#看看age有多少個不同的年齡,各個年齡的人一共有幾個人
print(data_count)
data_count[:10].plot(kind='bar')#將年齡的前10個進行柱狀圖展示
plt.show()
# plt.savefig('./temp')#將圖進行保存print(data.corr())#輸出列和列之間的相關性reg = LinearRegression()
x = data[['age', 'sex', 'bmi', 'children', 'smoker', 'region']]
y = data['charges']
# python3.6 報錯 sklearn ValueError: could not convert string to float: 'northwest',加入一下幾行解決
x = x.apply(pd.to_numeric, errors='coerce')
y = y.apply(pd.to_numeric, errors='coerce')
x.fillna(0, inplace=True)
y.fillna(0, inplace=True)poly_features = PolynomialFeatures(degree=3, include_bias=False)
X_poly = poly_features.fit_transform(x)reg.fit(X_poly, y)
print(reg.coef_)
print(reg.intercept_)y_predict = reg.predict(X_poly)plt.plot(x['age'], y, 'b.')
plt.plot(X_poly[:, 0], y_predict, 'r.')
plt.show()

四、總結

Ⅰ多項式回歸:叫回歸但并不是去做擬合的算法,PolynomialFeatures是來做預處理的,來轉換我們的數據,把數據進行升維!

Ⅱ升維有什么用?

答:升維就是增加更多的影響Y結果的因素,這樣考慮的更全面,最終的目的是要增加準確率!
還有時候,就像PolynomialFeatures去做升維,是為了讓線性模型去擬合非線性的數據!

ⅢPolynomialFeatures是怎么升維的?

答:可以傳入degree超參數,如果等于2,那么就會在原有維度基礎之上增加二階的數據變化!更高階的以此類推

Ⅳ如果數據是非線性的變化,但是就想用線性的模型去擬合這個非線性的數據,怎么辦?

答:1,非線性的數據去找非線性的算法生成的模型去擬合
2,可以把非線性的數據進行變化,變成類似線性的變化,然后使用線性的模型去擬合
PolynomialFeatures類其實就是這里說的第二種方式

Ⅴ保險的案例:

目的:未來來個新的人,可以通過模型來預測他的醫療花銷,所以,就把charges列作為y,其他列作為X維度

Ⅵ為什么每行沒有人名?

答:人名不會對最終的Y結果產生影響,所以可以不用

Ⅶ為什么要觀測注意數據多樣性,采樣要均勻?

答:就是因為你要的模型的功能是對任何年齡段的人都有一個好的預測,那么你的模型在訓練的時候 讀取的數據集,就得包含各個年齡段的數據,而且各個年齡段也得數據均勻,防止過擬合!

Ⅷ什么是Pearson相關系數?

答:Pearson相關系數是來測量兩組變量之間的線性相關性的!Pearson相關系數的區間范圍是-1到1之間
如果越接近于-1,說明兩組變量越負相關,一個變大,另一個變小,反之如果越接近于1,說明兩組變量越正相關,一個變大,另一個也跟著變大,如果越接近于0,說明越不相關,即一個變大或變小,另一個沒什么影響!
通過Pearson相關系數,如果發現兩個維度之間,相關系數接近于1,可以把其中一個去掉,做到降維!
通過Pearson相關系數,如果發現某個維度和結果Y之間的相關系數接近于0,可以把這個維度去掉,降維!

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

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

相關文章

JavaScript中的地圖與對象

JavaScript對象與地圖 (JavaScript Objects vs Maps) Objects are super popular in JavaScript so its not a term you are hearing for the first time even if youre a novice JS developer. Objects, in general, are a very common data structure that is used very ofte…

深發展銀行編碼器(解剖)

電池拆下來&#xff0c;再裝上&#xff0c;還能繼續用下&#xff0c;不會被重置 轉載于:https://www.cnblogs.com/ahuo/archive/2012/01/25/2329485.html

關于$.getJson

這是一個Ajax函數的縮寫&#xff0c;這相當于: 123456$.ajax({dataType: "json",url: url,data: data,success: success});數據會被附加到一個查詢字符串的URL中&#xff0c;發送到服務器。如果該值的data參數是一個普通的對象&#xff0c;它會轉換為一個字符串并使用…

leetcode 1. 兩數之和 思考分析

1、題目 給定一個整數數組 nums 和一個目標值 target&#xff0c;請你在該數組中找出和為目標值的那 兩個 整數&#xff0c;并返回他們的數組下標。 你可以假設每種輸入只會對應一個答案。但是&#xff0c;數組中同一個元素不能使用兩遍。 2、思考分析 雙for循環的時間復雜度…

六、邏輯回歸

一、何為邏輯回歸 邏輯回歸可以簡單理解為是基于多元線性回歸的一種縮放。 多元線性回歸y的取值范圍在(-∞&#xff0c;∞)&#xff0c;數據集中的x是準確的一個數值。 用這樣的一個數據集代入線性回歸算法當中會得到一個模型。 這個模型所具備的功能就是當有人給這個模型一個…

C# 調用Windows API實現兩個進程間的通信

使用Windows API實現兩個進程間&#xff08;含窗體&#xff09;的通信http://blog.csdn.net/huangxinfeng/article/details/5513608 從C#下使用WM_COPYDATA傳輸數據說到Marshal的應用http://www.cnblogs.com/jiangyh-is-me/archive/2006/06/05/417381.html 問題解決&#xff1a…

如何在Golang中返回錯誤?

In Golang, we return errors explicitly using the return statement. This contrasts with the exceptions used in languages like java, python. The approach in Golang to makes it easy to see which function returns an error? 在Golang中&#xff0c;我們使用return…

leetcode 383. 贖金信 思考分析

題目 給定一個贖金信 (ransom) 字符串和一個雜志(magazine)字符串&#xff0c;判斷第一個字符串 ransom 能不能由第二個字符串 magazines 里面的字符構成。如果可以構成&#xff0c;返回 true &#xff1b;否則返回 false。 (題目說明&#xff1a;為了不暴露贖金信字跡&#x…

Numpy(科學計算庫)---講解

本內容來自《跟著迪哥學Python數據分析與機器學習實戰》&#xff0c;該篇博客將其內容進行了整理&#xff0c;加上了自己的理解&#xff0c;所做小筆記。若有侵權&#xff0c;聯系立刪。 迪哥說以下的許多函數方法都不用死記硬背&#xff0c;多查API多看文檔&#xff0c;確實&a…

仿安居客好租網房產源碼

網站設計簡約&#xff0c;大方&#xff0c;清爽開發技術&#xff1a;ASP.NET3.5,SQL2005,VS2008功能簡介1、小區&#xff0c;二手房&#xff0c;租房小區發布&#xff0c;編輯&#xff0c;修改功能&#xff0c;圖片批量上傳2、支持積分&#xff0c;發布房源、發布論壇帖子可獲得…

Eclipse中classpath和deploy assembly的文件位置

classpath的配置信息存儲在工程根目錄下的.classpath文件 deploy assembly配置信息存儲在工程目錄下的.settings\org.eclipse.wst.common.component文件中轉載于:https://www.cnblogs.com/jubincn/p/3381087.html

LeetCode 454. 四數相加 II 思考分析

題目 給定四個包含整數的數組列表 A , B , C , D ,計算有多少個元組 (i, j, k, l) &#xff0c;使得 A[i] B[j] C[k] D[l] 0。 為了使問題簡單化&#xff0c;所有的 A, B, C, D 具有相同的長度 N&#xff0c;且 0 ≤ N ≤ 500 。所有整數的范圍在 -228 到 228 - 1 之間&am…

ruby 嵌套函數_Ruby嵌套直到循環帶有示例

ruby 嵌套函數嵌套直到循環 (Nested until loop) Alike for, while, and do...while, until loop can also be nested for meeting the specific purpose. In this type of nesting, two until loops work in the combination such that at first, the outer loop is triggered…

SQL Server 2008中SQL增強功能點Merge

sql server 2008提供了一個增強的Sql命令Merge,用法參看MSDN。能根據兩張表數據的不同&#xff0c;對兩張表進行數據執行插入&#xff0c;更新或刪除等操作&#xff0c;一般用在數據的抽取&#xff0c;例如&#xff0c;根據在另一個表中找到的差異在一個表中插入、更新或刪除行…

Numpy(科學計算庫)---小練習

1&#xff0c;打印當前Numpy版本 import numpy as np print (np.__version__) """ 1.22.3 """2&#xff0c;構造一個全零的矩陣&#xff0c;并打印其占用的內存大小 yy np.zeros((3,3)) yy """ array([[0., 0., 0.],[0., 0., …

【轉】Spark源碼分析之-scheduler模塊

原文地址&#xff1a;http://jerryshao.me/architecture/2013/04/21/Spark%E6%BA%90%E7%A0%81%E5%88%86%E6%9E%90%E4%B9%8B-scheduler%E6%A8%A1%E5%9D%97/ Background Spark在資源管理和調度方式上采用了類似于Hadoop YARN的方式&#xff0c;最上層是資源調度器&#xff0c;它負…

【C++grammar】析構、友元、拷貝構造函數、深淺拷貝

目錄1、Destructor&#xff08;析構函數&#xff09;在堆和棧(函數作用域與內嵌作用域)上分別創建Employee對象&#xff0c;觀察析構函數的行為2、Friend&#xff08;友元&#xff09;1、為何需要友元2、友元函數和友元類3、關于友元的一些問題3、Copy Constructor&#xff08;…

用mstsc /console 強行“踢”掉其它在線的用戶

由于公司有很多windows服務器&#xff0c;而且有很大一部分不在國內&#xff0c;所以經常需要使用遠程桌面進行連接&#xff0c;這其中&#xff0c;就會經常遇到因為超出了最大連接數&#xff0c;而不能連接的事情&#xff0c;其中最頭痛的就是&#xff0c;在連接國外的服務器時…

set vector_Java Vector set()方法與示例

set vector向量類set()方法 (Vector Class set() method) set() method is available in java.util package. set()方法在java.util包中可用。 set() method is used to replace the old element with the given element (ele) when it exists otherwise it sets the given ele…

Android PreferenceActivity 使用

我想大家對于android的系統配置界面應該不會陌生吧&#xff0c;即便陌生&#xff0c;那么下面的界面應該似曾相識吧&#xff0c;假若還是不認識&#xff0c;那么也沒有關系&#xff0c;我們這一節主要就是介紹并講解android 中系統配置界面的使用&#xff0c;相信大家看完本節后…