https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/train/exponential_decay

 

tf.train.exponential_decay  |  TensorFlow Core r1.15

Applies exponential decay to the learning rate. Aliases: tf.train.exponential_decay( learning_rate, global_step, decay_steps, decay_rate, staircase=False, name=None ) When training a model, it is often recommended to lower the learning rate as the training

www.tensorflow.org

 

tf.train.exponential_decay(
    learning_rate
,
    global_step
,
    decay_steps
,
    decay_rate
,
    staircase
=False,
    name
=None
)

 

decayed_learning_rate = learning_rate *
                        decay_rate
^ (global_step / decay_steps)

 

global_step = tf.Variable(0, trainable=False)
starter_learning_rate
= 0.1
learning_rate
= tf.compat.v1.train.exponential_decay(starter_learning_rate,
global_step
,
                                           
100000, 0.96, staircase=True)
# Passing global_step to minimize() will increment it at each step.
learning_step
= (
    tf
.compat.v1.train.GradientDescentOptimizer(learning_rate)
   
.minimize(...my loss..., global_step=global_step)
)

 

예제에서 첫 번째 파라메터로 들어간 starter_learning_rate는 말 그대로 최초 학습시 사용될 learning_rate이다.

두 번째 파라메터로 사용된 global_step은 현재 학습 횟수이다.

세 번째 파라메터는 위 예제에서는 100000이 들어갔는데 총 학습 횟수이다.

네 번째 파라메터는 얼마나 rate가 감소될 것인가를 나타낸다. 매번 0.96이 곱해진다고 생각하면 된다.

다섯 번째 파라메터는 이산적으로 학습 속도 감속 유무이다. 나는 이산적으로라는 말의 정의가 무엇인지 잘 모르겠지만 해당 파라메터가 true일때 decay_rate 즉 4번째 파라메터에 (global_step / decay_steps)의 승수가 적용된다.



출처: https://twinw.tistory.com/243 [흰고래의꿈]

  1. Save your Colab notebook.
  2. File > Download .ipynb
  3. On your terminal:
    jupyter nbconvert --to <output format> <filename.ipynb>

 

cmd 창

출처 : https://torbjornzetterlund.com/how-to-save-a-google-colab-notebook-as-html/

Matthews 상관 계수는 이진 및 멀티 클래스 분류의 품질 측정으로 기계 학습에 사용됩니다. 그것은 참과 거짓 긍정과 부정을 고려하고 일반적으로 클래스의 크기가 매우 다른 경우에도 사용할 수있는 균형 잡힌 척도로 간주됩니다. MCC는 본질적으로 -1과 +1 사이의 상관 계수 값입니다. +1의 계수는 완전 예측, 0은 평균 랜덤 예측, -1은 역 예측을 나타냅니다. 통계량은 파이 계수라고도합니다. [출처 : Wikipedia]

https://scikit-learn.org/stable/modules/generated/sklearn.metrics.matthews_corrcoef.html

from sklearn.metrics import matthews_corrcoef

Label = data["LABEL"].values
Gender = data["GENDER"].values
Age = data["AGE"].values
Job = data["JOB"].values

y_true = Label
y_pred = Job
matthews_corrcoef(y_true, y_pred)

MCC의 공식

 

피어슨 상관계수, 스피어만 상관계는 모수전, 비모수적에 대한 구분으로 연속형 자료에서 가능

 

둘다 이산적 형태이면 Phi coefficient

이산과 연속이 섞여있으면 point-biserial correlation coefficient

https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.stats.pointbiserialr.html

 

scipy.stats.pointbiserialr — SciPy v0.14.0 Reference Guide

Parameters:x : array_like of bools y : array_like

docs.scipy.org

from scipy import stats

y_true = Label
y_pred = Age

stats.pointbiserialr(y_true, y_pred)

 

 

+ Recent posts