GithubHelp home page GithubHelp logo

selectnet's Introduction

Abstract

Feature selection plays an important role in many machine learning and data mining applications. We propose a regularization loss on feature space, ,to force the model using the less feature group to solve the original problem. As common regularization loss in Deep Learning, we apply L1 norm on w, and use SGD to make it converged.

Introduction

Deep learning 一般來說是不做feature selection,其優異的分類能力,使人們仍然能夠接受黑箱的缺點。
在不傷害模型能力下,feature selection即便無法帶來性能上的改進,仍可以從Input dimension的縮減得到幫助。
幫助理解該資料及與模型的關係,甚或是資料及代表的意義。
Feature selection 在Network上有幾種做法:

  1. weight based : 針對與某項feature相關的weight,越重要的feature其表現會作用在這些相關的weight上。
  2. output sensitivity based : 針對某項特定的feature對於模型的輸出影響力大小,常見做法是做feature ranking,然後逐次移除feature。

weight based的缺點是,network的複雜度越大,越難以分析weight之間的作用程度,包括shared-weight以及activation function。
而output sensitivity based的缺點有兩個,除去特定feature的過程屬於greedy strategy,並且重複訓練的過程非常耗費運算資源。
這篇的做法透過觀察w收斂的趨勢,了解作用在feature space上的機率分佈。

Original regression loss in Deep learning



左邊是L2 regularization tern,初步的想法是再增加一個限制項。



透過增加L1 loss使得w收斂成比較sparse的向量,有些值為零。
這時候可以得知哪些feature,是不需要使用的。
詳細的計算式定義:



目前正在研究加入entropy是否有幫助。
透過對sigmoid(w)做L1 loss而不是直接針對w,使得w'可以持續下降到負數,相較於w只能下降到0更加smooth(?)。
(CK老師建議直接使用relu來試試看。)
另外可以使用softmax或是summation ratio來利用w_prine形成feature saliency。
目前採用summation ratio,原因也是因為summation比較不陡峭。(需要補充說明)
(在w'極小值時,loss會比softmax指數還要大,藉此比較容易下降到0。)

由此一來透過觀察w_ratio就可以理解feature如何經過w_ratio的weight mask然後進入模型的輸入。
可以設定某個threshold來做feature selection,後面MNIST的例子就是如此。

目前只是實驗猜測,下列嘗試過的Loss function

Toy example, bmi

y = w / (h^2) + small noise, scalar
X是四維的向量,前兩維x1,x2 = w, h,後兩維x3,x4分別是不重要的normal distrbution。

mse loss相當低代表network可以fit 這個回歸問題。
w也持續下降中,而有幾項不相關的項,例如w3, w4下降的比較快

bmi w chart

最終ratio_w顯示,Network只使用了前兩項w,h就可以fit這個回歸問題,表示這個regularization tern可以找出哪些feature才是network有使用到的。
w3, w4趨近於0

bmi ratio_w chart

summary

bmi log summary

MNIST example

由於numerical data比較難以找出feature saliency。
這邊有做縮放到10x10
實驗設定的threshold是0.001
看看w_ratio,看得出明顯差異,我解釋成某些pixel是比較重要的。
再更進一步地去除w_ratio < threshold的pixel,兩次同參數的訓練結果如下。
mnist_mask_1mnist_mask_2
訓練過程:
mnist_overview_1mnist_overview_2

CIFAR-10 example

相較於mnist找出了有些pixel可以不使用,cifar-10找不出來明顯不重要的pixel。
以下是cifar-10的範例圖,我認爲這個結果是合理的。
cifar10 example

對於非相關項的噪音抵抗力

與network pruning的比較,CK的建議

[TensorFlow Model Optimization Toolkit — Pruning API][https://medium.com/tensorflow/tensorflow-model-optimization-toolkit-pruning-api-42cac9157a6a?fbclid=IwAR2ZD9euHYiKh-OvuKYe4YltYCtosM_oJTlAdnN5AJwQUTDO9e8OW-8d9uM]

other loss

Loss

與單變量統計以及線性模型的比較,XOR資料

feature ranking

有沒有可能每次用不同組的feature去做過濾,然後留下來的feature就得分。
以得分高低來說明feature的重要性。

related papers

  1. A Penalty-Function Approach for Pruning Feedforward Neural Networks, IEEE, 1997. 246 citations.

    short critique : 使用input-hidden-output共三層的FCN作為範例,對output node有影響的共有兩層learnable matrix, w1,w2
    只要其中某一條link(tanh(x*w1_i)*w2_j)的值足夠小便表示這條link可以刪除,w1_i & w2_j都可以被設為0。
    一樣透過regularization loss:

    來限制weight。
    主要還是在討論如何做network pruning,這篇主要相關是下一篇同作者使用這種演算法來做feature selection。
    有提到一個L2 loss的變種,Loss = w^2 / (1 + w^2),會將loss bound在[0, 1],這可以加入regularization loss 設計討論。

  2. Neural-Network Feature Selector, IEEE, 1997. 427 citations.

    short critique : 承續上篇的loss,使得weight有sparsity的特性,討論如何做feature selection。
    Method : 首先使用全部N個feature訓練一個network,然後定義一個能夠接受的最小performance drop,在這篇裡面使用accuracy。
    再來分別抽掉一個feature,利用N-1個feature訓練出N-1個network,然後對performance做排序,只要最差的那個network還在允許performance drop範圍內,就繼續抽掉feature。
    具體來說是一個greedy strategy,有點像Decision Tree。
    Drawbacks : 首先是greedy的順序有沒有影響不確定,這是對於exhausive search for optimal solution的取捨。再者是訓練時間太過誇張。time complexity = O(N! - k!), k = final feature count.

  3. Feature screening using signal-to-noise ratios, nercom, 2000. 96 citations.

    short critique : 這篇沒什麼作用,主要是提出的方法並不實用,但是提供了另一種衡量feature saliency 的方式,SNR based。

    support : 裡面分了三個feature saliency measure. Partial derivative based, weighted based and SNR based.
    單獨的critique

  4. Feature selection with neural networks, 2001. 236 citaions.
    short critique : support : 裡面提到了有weights-based(上面那篇)跟signal-to-noise retio以及output sensitivity based以及三個方面,survey的時候可以注意。

較新的works

  1. Feature Selection Based on Structured Sparsity- A Comprehensive Study, IEEE, 2017. 95
    這是一篇針對比較古老方法的review,沒有提供太多面向,注重在介紹Group Lasso, Graph Lasso,以及一些feature structure等等。
    從簡單的lasso linear regression開始談,以及他的變形group lasso, graph lasso等等。
    另外一個概念是multi-task,直接透過norm of matrix來限制W,一樣利用norm p, 0 < p <= 1,來造成weight sparsity。
    應該是想保留在multi-task底下,能夠做到feature selection在feature space上真正獨立,而不是只在特定任務下獨立,會得到比較general的feature set。
    注意一下matrix norm。 norm2,1會造成出現zero row而norm1,2 出現zero column,
    這代表要出現dead neuron,對所有connected link的weight都是零。
    或是filter neuron,只對特定幾個connected link的weight是零。
    這對network pruning的設計有點幫助。

    我在這篇裡面得到比較有效的資訊是,有關解norm p, 0 < p < 1的方式,這個部分也許可以再加入SelectNet,形成更加sparse的weight。
    分別是以下兩篇
    還有一個好處是提供了相當多方法的實驗結果:
    單變量統計的有Fisher Score, Gini, information Gain, T-test, Chi-Square test.
    還有一些我認為比較不常用的,L1 SVM, Lasso等等。
    但是這些dataset都不好找,有關生物資訊的,不是需要申請就是要錢,後面如果找不到適合的dataset可以再回來嘗試。

  2. Feature Selection- A Data Perspective, IEEE, 2018, 265
    這是一篇非常好的review,單獨critique

norm 0.5

A unified algorithm for mixed 𝑙2,𝑝 -minimizations and its application in feature selection, 2014. 23.
Feature Selection at the Discrete Limit, AAAI, 2014. 31.

model attack

針對多類別分類模型的防禦,可以嘗試對特定class做feature selection,然後把這個feature set當作filter,藉此達到feature squeeze的效果。

selectnet's People

Contributors

k123321141 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.