Problem using discretize function

조회 수: 8 (최근 30일)
Muhammad Nouman Aqil
Muhammad Nouman Aqil 2021년 2월 26일
I have a column "Net Pickups" in a table which contains integers from about -100 to 100. I want to discretize it to create a categorical variable "Demand" such that:
· Net Pickups < 0: ‘Low’
· 0 <= Net Pickups < 15: ‘Medium’
· Net Pickups >= 15: ‘High’
However, I'm getting the error that my 'values' vector should have the same length as my number of bins i.e. 3. What am I doing wrong? Here's a ballpark of the code I think should be used
values = [min(trainData.NetPickups) 0 15 max(trainData.NetPickups)]
discretize(trainData.NetPickups,3,values,"categorical",{'Low','Medium','High'})

답변 (0개)

카테고리

Help CenterFile Exchange에서 Cell Arrays에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by