• 로그인
  • 장바구니에 상품이 없습니다.

home2 게시판 Python, SQL 게시판 이 사람이 죽을 확률은? 터미널 warning 저렇게 뜨는거 맞나요?

이 사람이 죽을 확률은? 터미널 warning 저렇게 뜨는거 맞나요?

2 글 보임 - 1 에서 2 까지 (총 2 중에서)
  • 글쓴이
  • #89875

    조승엽
    참가자
    ======================터미널내용
    2023-07-06 15:59:23.109216: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX AVX2
    To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.        
    2023-07-06 15:59:23.530091: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1510] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 9601 MB memory:  -> device: 0, name: NVIDIA GeForce RTX 3060, pci bus id: 0000:07:00.0, compute capability: 8.6
    Epoch 1/20
    WARNING:tensorflow:Layers in a Sequential model should only have a single input tensor, but we receive a <class 'dict'> input: {'PassengerId': <tf.Tensor 'ExpandDims_5:0' shape=(None, 1) dtype=int64>, 'Pclass': <tf.Tensor 'ExpandDims_6:0' shape=(None, 1) dtype=int64>, 'Name': <tf.Tensor 'ExpandDims_3:0' shape=(None, 1) dtype=string>, 'Sex': <tf.Tensor 'ExpandDims_7:0' shape=(None, 1) dtype=string>, 'Age': <tf.Tensor 'ExpandDims:0' shape=(None, 1) dtype=float64>, 'SibSp': <tf.Tensor 'ExpandDims_8:0' shape=(None, 1) dtype=int64>, 'Parch': <tf.Tensor 'ExpandDims_4:0' shape=(None, 1) dtype=int64>, 'Ticket': <tf.Tensor 'ExpandDims_9:0' shape=(None, 1) dtype=string>, 'Fare': <tf.Tensor 'ExpandDims_2:0' shape=(None, 1) dtype=float64>, 'Embarked': <tf.Tensor 'ExpandDims_1:0' shape=(None, 1) dtype=string>}
    Consider rewriting this model with the Functional API.
    WARNING:tensorflow:Layers in a Sequential model should only have a single input tensor, but we receive a <class 'dict'> input: {'PassengerId': <tf.Tensor 'ExpandDims_5:0' shape=(None, 1) dtype=int64>, 'Pclass': <tf.Tensor 'ExpandDims_6:0' shape=(None, 1) dtype=int64>, 'Name': <tf.Tensor 'ExpandDims_3:0' shape=(None, 1) dtype=string>, 'Sex': <tf.Tensor 'ExpandDims_7:0' shape=(None, 1) dtype=string>, 'Age': <tf.Tensor 'ExpandDims:0' shape=(None, 1) dtype=float64>, 'SibSp': <tf.Tensor 'ExpandDims_8:0' shape=(None, 1) dtype=int64>, 'Parch': <tf.Tensor 'ExpandDims_4:0' shape=(None, 1) dtype=int64>, 'Ticket': <tf.Tensor 'ExpandDims_9:0' shape=(None, 1) dtype=string>, 'Fare': <tf.Tensor 'ExpandDims_2:0' shape=(None, 1) dtype=float64>, 'Embarked': <tf.Tensor 'ExpandDims_1:0' shape=(None, 1) dtype=string>}
    Consider rewriting this model with the Functional API.
    2023-07-06 15:59:24.515930: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:185] None of the MLIR Optimization Passes are enabled (registered 2)
    2023-07-06 15:59:25.361002: I tensorflow/stream_executor/cuda/cuda_blas.cc:1760] TensorFloat-32 will be used for the matrix multiplication. This will only be logged once.
    28/28 [==============================] - 1s 7ms/step - loss: 0.6204 - acc: 0.6824
    Epoch 2/20
     
    =========================이렇게 진행은 되요. 
    tensorflow 2.6 버전이고 입력은 아래같이 했어요.
    
    
    import pandas as pd
    import tensorflow as tf
    # version3: 노말라이저 함수 추가, validation_split을 할수 없으니 validation_data 만들어야함
    data = pd.read_csv('train.csv')
    평균 = data['Age'].mean()
    최빈값 = data['Embarked'].mode()
    data['Age'].fillna(value=30, inplace= True) 
    data['Embarked'].fillna(value='S', inplace=True)
    정답 = data.pop('Survived') 
    ds = tf.data.Dataset.from_tensor_slices((dict(data), 정답))
    # 그냥 숫자로 집어 넣을거:numeric_column : Fare, Parch, SibSp,
    # 뭉퉁 그려서 집어 넣을거: bucketized_column : Age
    # 종류 몇개없는 카테고리화해서 넣을거: indicator_column : Sex, Embarked, Pclass
    # 종류가 너무 많은 카테고리: embedding_column : Ticket,
    feature_columns =[]
    # tf.feature_column.numeric_column('컬럼명', normalizer_fn=노말라이저함수)
    def 노말라이저함수(x):
      # return 0 과 1 사이로 압축한 x
      최소값 = data['Fare'].min()
      최대값 = data['Fare'].max()
      return (x - 최소값) / (최대값 - 최소값)
    ### Fare - numeric_column, normalizer
    feature_columns.append( tf.feature_column.numeric_column('Fare', normalizer_fn=노말라이저함수) )
    ### SibSp - numeric_column
    feature_columns.append( tf.feature_column.numeric_column('SibSp') )
    ### Parch - numeric_column
    feature_columns.append( tf.feature_column.numeric_column('Parch') )
    ### Age - bucketized_column
    Age = tf.feature_column.numeric_column('Age')
    Age_bucket = tf.feature_column.bucketized_column(Age, boundaries=[10,20,30,40,50,60])
    feature_columns.append( Age_bucket )
    ### Sex - indicator_column
    vocab = data['Sex'].unique()
    cat = tf.feature_column.categorical_column_with_vocabulary_list('Sex', vocab)
    one_hot_cat = tf.feature_column.indicator_column(cat)
    feature_columns.append( one_hot_cat )
    ### Embarked - indicator_column
    vocab = data['Embarked'].unique()
    cat = tf.feature_column.categorical_column_with_vocabulary_list('Embarked', vocab) 
    one_hot_cat = tf.feature_column.indicator_column(cat) 
    feature_columns.append( one_hot_cat )
    ### Pclass - indicator_column
    vocab = data['Pclass'].unique()
    cat = tf.feature_column.categorical_column_with_vocabulary_list('Pclass', vocab) 
    one_hot_cat = tf.feature_column.indicator_column(cat) 
    feature_columns.append( one_hot_cat )
    ### Ticket - embedding_column
    vocab = data['Ticket'].unique()
    cat = tf.feature_column.categorical_column_with_vocabulary_list('Ticket', vocab) 
    embad_cat = tf.feature_column.embedding_column(cat, dimension=9)
    feature_columns.append( embad_cat )
    model = tf.keras.Sequential([
        tf.keras.layers.DenseFeatures(feature_columns),
        tf.keras.layers.Dense(128, activation='relu'),
        tf.keras.layers.Dense(64, activation='relu'),
        tf.keras.layers.Dropout(0.2),
        tf.keras.layers.Dense(1, activation='sigmoid'),
    ])
    model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['acc'])
    ds_batch = ds.batch(32) # tf.keras.layers.DenseFeatures 쓸때 batch 이거 안쓰면 에러남
    model.fit(ds_batch, validation_data=(), shuffle= True, epochs=20) 
    # 데이터가 batch라 validation_split=0.2 이런식으로 할수가 없음, numpy_array나 tensor만 가능
    #89905

    codingapple
    키 마스터
    넴 워닝은 상관없습니다
2 글 보임 - 1 에서 2 까지 (총 2 중에서)
  • 답변은 로그인 후 가능합니다.

About

현재 월 700명 신규수강중입니다.

  (09:00~20:00) 빠른 상담은 카톡 플러스친구 코딩애플 (링크)
  admin@codingapple.com
  이용약관
ⓒ Codingapple, 강의 예제, 영상 복제 금지
top

© Codingapple, All rights reserved. 슈퍼로켓 에듀케이션 / 서울특별시 강동구 고덕로 19길 30 / 사업자등록번호 : 212-26-14752 온라인 교육학원업 / 통신판매업신고번호 : 제 2017-서울강동-0002 호 / 개인정보관리자 : 박종흠