> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-vortex-format.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> 각 범주별로 `(P(tag = 1) - P(tag = 0))(log(P(tag = 1)) - log(P(tag = 0)))` 값을 계산합니다.

# categoricalInformationValue

<div id="categoricalInformationValue">
  ## categoricalInformationValue
</div>

도입 버전: v20.1.0

이진 타깃 변수와 관련된 범주형 피처의 정보값(IV)을 계산합니다.

각 범주에 대해 함수는 다음 값을 계산합니다: `(P(tag = 1) - P(tag = 0)) × (log(P(tag = 1)) - log(P(tag = 0)))`

여기서:

* P(tag = 1)은 주어진 범주에서 타깃이 1일 확률입니다
* P(tag = 0)은 주어진 범주에서 타깃이 0일 확률입니다

정보값(Information Value)은 예측 모델링에서 범주형 피처와 이진 타깃 변수 사이의 관계 강도를 측정하는 데 사용되는 통계량입니다.
절댓값이 클수록 예측력이 더 높음을 의미합니다.

결과는 각 이산형(범주형) 피처 `[category1, category2, ...]`가 `tag` 값을 예측하는 학습 모델에 얼마나 기여하는지를 나타냅니다.

**구문**

```sql theme={null}
categoricalInformationValue(category1[, category2, ...,]tag)
```

**인수**

* `category1, category2, ...` — 분석할 하나 이상의 범주형 피처입니다. 각 범주는 이산 값을 포함해야 합니다. [`UInt8`](/ko/reference/data-types/int-uint)
* `tag` — 예측 대상 이진 변수입니다. 값은 0과 1이어야 합니다. [`UInt8`](/ko/reference/data-types/int-uint)

**반환 값**

범주의 각 고유한 조합에 대한 정보 값을 나타내는 Float64 값의 배열을 반환합니다. 각 값은 대상 변수에 대해 해당 범주 조합의 예측력을 나타냅니다. [`Array(Float64)`](/ko/reference/data-types/array)

**예시**

**연령대와 모바일 사용량을 분석하는 기본 사용법**

```sql title=Query theme={null}
CREATE TABLE visits (is_young UInt8, is_female UInt8, is_mobile UInt8) ENGINE = Memory;

-- 80 of the 100 young visitors browse on a mobile device, and only 20 of the 100 older ones do,
-- while the sex of a visitor says nothing about the device.
INSERT INTO visits SELECT 1, number % 2, number < 80 FROM numbers(100);
INSERT INTO visits SELECT 0, number % 2, number < 20 FROM numbers(100);

SELECT round(categoricalInformationValue(is_young, is_mobile)[1], 4) AS iv FROM visits;
```

```response title=Response theme={null}
┌─────iv─┐
│ 0.8318 │
└────────┘
```

**여러 범주형 피처와 사용자 인구통계 정보**

```sql title=Query theme={null}
-- The age of a visitor predicts the device, the sex of a visitor does not.
SELECT arrayMap(x -> round(x, 4), categoricalInformationValue(is_young, is_female, is_mobile)) AS iv
FROM visits;
```

```response title=Response theme={null}
┌─iv─────────┐
│ [0.8318,0] │
└────────────┘
```
