BEGIN
INSERT INTO SETTINGS_GLM(SETTING_NAME, SETTING_VALUE)
VALUES (DBMS_DATA_MINING.ALGO_NAME, DBMS_DATA_MINING.ALGO_NEURAL_NETWORK);
INSERT INTO SETTINGS_GLM (SETTING_NAME, SETTING_VALUE)
VALUES (DBMS_DATA_MINING.PREP_AUTO, DBMS_DATA_MINING.PREP_AUTO_ON);
INSERT INTO SETTINGS_GLM (SETTING_NAME, SETTING_VALUE)
VALUES (DBMS_DATA_MINING.NNET_NODES_PER_LAYER, '80,80');
END;
/
-- 1. 인공신경망의 구조를 은닉1층에서 은닉2층으로 재구성합니다.
DROP TABLE SETTINGS_GLM;
CREATE TABLE SETTINGS_GLM
AS
SELECT *
FROM TABLE (DBMS_DATA_MINING.GET_DEFAULT_SETTINGS)
WHERE SETTING_NAME LIKE '%GLM%';
BEGIN
INSERT INTO SETTINGS_GLM(SETTING_NAME, SETTING_VALUE)
VALUES (DBMS_DATA_MINING.ALGO_NAME, DBMS_DATA_MINING.ALGO_NEURAL_NETWORK);
INSERT INTO SETTINGS_GLM (SETTING_NAME, SETTING_VALUE)
VALUES (DBMS_DATA_MINING.PREP_AUTO, DBMS_DATA_MINING.PREP_AUTO_ON);
INSERT INTO SETTINGS_GLM (SETTING_NAME, SETTING_VALUE)
VALUES (DBMS_DATA_MINING.NNET_NODES_PER_LAYER, '80,80');
END;
/
-- 2. 머신러닝 모델을 생성합니다.
BEGIN
DBMS_DATA_MINING.DROP_MODEL('MD_GLM_MODEL');
END;
/
BEGIN
DBMS_DATA_MINING.CREATE_MODEL(
MODEL_NAME => 'MD_GLM_MODEL',
MINING_FUNCTION => DBMS_DATA_MINING.REGRESSION,
DATA_TABLE_NAME => 'CONCRETE_TRAIN',
CASE_ID_COLUMN_NAME => 'C_ID',
TARGET_COLUMN_NAME => 'STRENGTH',
SETTINGS_TABLE_NAME => 'SETTINGS_GLM');
END;
/
-- 3. 인공신경망의 환경 구성정보를 확인합니다.
SELECT SETTING_NAME, SETTING_VALUE
FROM ALL_MINING_MODEL_SETTINGS
WHERE MODEL_NAME = 'MD_GLM_MODEL'
AND SETTING_NAME IN ('NNET_HIDDEN_LAYERS','NNET_NODES_PER_LAYER');
-- 4. 신경망 모델이 예측한 결과를 확인합니다.
SELECT C_ID, STRENGTH 실제값, ROUND( PREDICTION(MD_GLM_MODEL USING *),2) 예측값
FROM CONCRETE_TEST;
-- 5. 실제 값과 예측 값 간의 상관관계를 확인합니다.
SELECT ROUND(CORR(PREDICTED_VALUE, STRENGTH),2) 상관관계
FROM (
SELECT C_ID, PREDICTION(MD_GLM_MODEL USING *) PREDICTED_VALUE,
PREDICTION_PROBABILITY(MD_GLM_MODEL USING * ) PROB, STRENGTH
FROM CONCRETE_TEST
);