H.PROJECT

Home Project
  • 홈
  • 태그
  • 방명록

reshape 1

Expected 2D array, got 1D array instead 에러 : flatten(), reshape(), ravel() 알아보기

에러 : Expected 2D array, got 1D array instead:array=[0.23 0.21 0.23 ... 0.7 0.86 0.75].Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample. 오늘 아무 생각없이 모델 피팅하다가 이런 에러문구가 떴다.머신러닝 모델에서 fit 메소드는 2차원 배열을 입력으로 기대한다. 그런데, 1D 배열을 인풋으로 피팅하였기 때문에 에러가 발생한 것이다.이럴 경우, 1차원을 2차원으로 변환해야한다. reshape메소드를 통해 배열의 형태를 바꿀 수 있다. 예를 ..

Legacy/[Legacy] Machine Learning 2019.02.23
이전
1
다음
더보기
프로필사진

Making Life Better.

  • 분류 전체보기 (49)
    • 2026 실험실 (0)
    • Essay (0)
    • Causal Inference (0)
    • Product Analytics (9)
      • Statistics (5)
      • AB Test (4)
      • Causal Inference (0)
    • Machine Learning 2025 (1)
    • Strategy (0)
      • Wharton Strategic Managemen.. (0)
    • Product Design (18)
      • 프로덕트 디자인 (4)
      • 레퍼런스 분석 (6)
      • 문제해결 스터디 (3)
      • 아티클 스터디 (4)
      • 프로젝트 (1)
    • Legacy (21)
      • [Legacy] 알고리즘 (1)
      • [Legacy] 백준 (1)
      • [Legacy] Python (3)
      • [Legacy] Machine Learning (7)
      • [Legacy] Project (2)
      • [Legacy] Dart (3)
      • [Legacy] Flutter (1)
      • [Legacy] Data (3)

최근글과 인기글

  • 최근글
  • 인기글

방문자수Total

  • Today :
  • Yesterday :

티스토리툴바