Database/Oracle2024. 4. 24. 15:50

사용 /*+ parallel( ) */ 

SELECT
      /*+ parallel(TBL1,4) parallel(TBL2,4) */ 
FROM TBL_TEST1 TBL1, TBL_TEST2 TBL2
WHERE TBL1.USER_NAME = TBL2.USER_NAME

임시 정리

Posted by 비니미니파
Python2023. 6. 1. 17:34

chatGPT 에게 LSTM 간단한 예제를 만들어 달라고 했더니 이런걸 만들어 준다.

LSTM(Long Short-Term Memory)은 순환 신경망(RNN)의 한 종류로서, 장기 의존성(long-term dependency)을 학습하기에 효과적인 구조를 가진 모델입니다. LSTM은 시계열 데이터나 자연어 처리와 같이 순차적인 데이터를 다루는데 주로 사용됩니다. by ChatGPT

 

import numpy as np
import tensorflow as tf

# 입력 시계열 데이터 생성
# 간단한 사인 함수를 사용하여 시계열 데이터를 생성합니다.
def generate_sequence(length):
    freq = np.random.uniform(0.1, 1.0)
    x = np.sin(np.arange(0, length) * freq)
    return x

# 데이터셋 생성
def generate_dataset(seq_length, n_samples):
    X = []
    Y = []
    for _ in range(n_samples):
        seq = generate_sequence(seq_length)
        X.append(seq[:-1])  # 입력 시퀀스
        Y.append(seq[1:])   # 출력 시퀀스
    X = np.array(X)
    X = np.reshape(X, [n_samples, seq_length-1, 1])
    Y = np.array(Y)
    Y = np.reshape(Y, [n_samples, seq_length-1, 1])
    return X, Y

# LSTM 모델 생성
def create_lstm_model(seq_length):
    model = tf.keras.models.Sequential()
    model.add(tf.keras.layers.LSTM(20, input_shape=(seq_length-1, 1), return_sequences=True))
    model.add(tf.keras.layers.Dense(1, activation='linear'))
    return model

# 데이터셋 생성
seq_length = 10
n_samples = 1000
X, Y = generate_dataset(seq_length, n_samples)

# LSTM 모델 생성
model = create_lstm_model(seq_length)

# 모델 컴파일
model.compile(loss='mse', optimizer='adam')

# 모델 훈련
model.fit(X, Y, epochs=10, batch_size=32)

# 새로운 시퀀스 생성 및 예측
new_seq = generate_sequence(seq_length)
new_input = new_seq[:-1]
new_input = np.reshape(new_input, [1, seq_length-1, 1])
predicted_output = model.predict(new_input)
print("입력 시퀀스:", new_seq[:-1])
print("예측된 다음 값:", predicted_output.flatten())

 

만들어진 코드를 코랩(colab)에서 실행

잘 된다.

Posted by 비니미니파
Android2023. 5. 19. 15:18

 

 API레벨    
 롤리팝  5.0  21
 롤리팝  5.1   22 
 마시멜로  6.0   23 
 마시멜로   6.1   23 
 누가   7.0 ,7.1   24 , 25
 오레오  8.0,8.1   26,27 
파이 9.0 28
Android 10(퀸스타르트) 10 29
Android 11(레드벨벳케이크) 11 30
Android 12(스노우콘) 12 31
Android 13(티라미수) 13 33
Android 14(업사이드다운케이크) 14 34
Posted by 비니미니파
Python2023. 5. 19. 15:11

python schedule 을 이용한 프로그램 시작과 종료

import schedule
import time

current_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
# print(current_time)

def start_program():
    print(current_time)
    print("프로그램이 시작되었습니다.")

def end_program():
    print(current_time)
    print("프로그램이 종료되었습니다.")

# 시작 시간과 종료 시간 설정
start_time = "15:05"  # 시작시간
end_time = "15:06"  # 종료시간

# 스케줄링된 작업 추가
schedule.every().day.at(start_time).do(start_program)  # 시작 시간에 프로그램 시작 작업 추가
schedule.every().day.at(end_time).do(end_program)  # 종료 시간에 프로그램 종료 작업 추가

# 무한루프를 돌며 스케줄링된 작업 실행
while True:
    schedule.run_pending()
    time.sleep(1)

 

내가 안짰음...

chatgpt 가 짜줌 ^^

 

Posted by 비니미니파
Python2023. 4. 4. 14:47

 

import time

from datetime import datetime

while True:

    # 현재 시간 출력 YYYY-MM-DD HH:MI:SS 
    s = datetime.now().strftime('%Y-%m-%d %H:%M:%S')

    print(s)

    # 1초간 sleep
    time.sleep(1)

 

python 시간 포맷을 알아보려면 아래 사이트를 방문 하자!

https://docs.python.org/3/library/datetime.html

 

datetime — Basic date and time types

Source code: Lib/datetime.py The datetime module supplies classes for manipulating dates and times. While date and time arithmetic is supported, the focus of the implementation is on efficient attr...

docs.python.org

 

Posted by 비니미니파