第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何設(shè)置要在隨機搜索中使用的指數(shù)分布的界限?

如何設(shè)置要在隨機搜索中使用的指數(shù)分布的界限?

縹緲止盈 2022-05-24 12:48:30
我正在嘗試使用 Sci-Kit Learn 找到分類問題的最佳參數(shù)值。我發(fā)現(xiàn)這樣做的一種方法是使用RandomizedSearchCV() 當(dāng)我設(shè)置我希望我的分類器使用的參數(shù)的字典時,我遇到了一個問題:我想使用 2^-15 和 2 之間的指數(shù)分布^15 用于 C 和 gamma 參數(shù)。我做了一些研究,發(fā)現(xiàn)scipy.stats.expon可以解決我的問題。但是,我不知道如何設(shè)置我正在尋找的界限。scoring = {       'accuracy': 'accuracy',       'precision_macro': 'precision_macro',       'recall_macro': 'recall_macro',       'f1_macro': 'f1_macro'}param_distributions = {        'kernel': ['linear', 'poly', 'rbf', 'sigmoid'],        'C': expon(), # Here are the line that I should set the distribution        'gamma': expon(), # Also here        'degree': randint(2, 7),        'coef0': [0],        'probability': [True]}cv = StratifiedKFold(n_splits=4)rdm = RandomizedSearchCV(             estimator=SVC(),             param_distributions=param_distributions,             n_iter=10,             scoring=scoring,             n_jobs=-1,             iid=False,             cv=cv,             refit='accuracy',             random_state=787870)rdm_results = rdm.fit(X, y)我應(yīng)該如何處理這個?有沒有一種簡單的方法來獲得我想要的分布?
查看完整描述

1 回答

?
慕婉清6462132

TA貢獻1804條經(jīng)驗 獲得超2個贊

您可以先使用numpy.random.exponential從指數(shù)分布生成隨機浮點數(shù),然后使用sklearn.preprocessing.minmax_scale對它們進行 min-max 縮放,如下所示:


import numpy as np

from sklearn.preprocessing import minmax_scale

# define the number of parameters to generate 

number_of_params = 500

# generate random floats from an exponential distribution

x = np.random.exponential(scale=1.0, size=number_of_params)

# min-max scaler

x = minmax_scale(x, feature_range=(2**-15, 2**15), axis=0, copy=True)


查看完整回答
反對 回復(fù) 2022-05-24
  • 1 回答
  • 0 關(guān)注
  • 147 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號