<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>Adam_Ham.log</title>
        <link>https://velog.io/</link>
        <description>Data Scientist | AI Engineer</description>
        <lastBuildDate>Sat, 07 Feb 2026 06:06:19 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <image>
            <title>Adam_Ham.log</title>
            <url>https://velog.velcdn.com/images/adam_ham/profile/257035d0-5893-4f10-a046-05a7a2d1b1a4/image.JPEG</url>
            <link>https://velog.io/</link>
        </image>
        <copyright>Copyright (C) 2019. Adam_Ham.log. All rights reserved.</copyright>
        <atom:link href="https://v2.velog.io/rss/adam_ham" rel="self" type="application/rss+xml"/>
        <item>
            <title><![CDATA[마켓팅 전략과 데이터(SKAN)]]></title>
            <link>https://velog.io/@adam_ham/%EB%A7%88%EC%BC%93%ED%8C%85-%EC%A0%84%EB%9E%B5%EA%B3%BC-%EB%8D%B0%EC%9D%B4%ED%84%B0SKAN</link>
            <guid>https://velog.io/@adam_ham/%EB%A7%88%EC%BC%93%ED%8C%85-%EC%A0%84%EB%9E%B5%EA%B3%BC-%EB%8D%B0%EC%9D%B4%ED%84%B0SKAN</guid>
            <pubDate>Sat, 07 Feb 2026 06:06:19 GMT</pubDate>
            <description><![CDATA[<h3 id="ltvlife-time-value와-roasreturn-on-ad-spend">LTV(Life Time Value)와 ROAS(Return on Ad Spend)</h3>
<ul>
<li>LTV(고객 생애 가치) :
고객이 특정 제품이나 서비스를 사용하는 시간 동안 창출하는 평균 수익의 추정치
마케터는 LTV를 근거로 유저 유입 마케팅 예산을 적절히 책정하여 인앱 구매, 인앱 광고, 앱 구독과 같은 수입원의 흐름을 최적화하고 수익성을 유지</li>
<li>ROAS(Return on Ad Spend)
광고에 지출된 1달러당 얻은 수익
앱을 처음 설치 후 3,7,30일차 ROAS를 통해 고가치 유저를 유입시킨 채널이나 캠페인 파악가능<h3 id="ios-skan-40">iOS SKAN 4.0</h3>
<h4 id="sotrekit-ad-networkskan">SotreKit Ad Network(SKAN)</h4>
기존의 모바일 광고가</li>
<li>어떤 광고 → 어떤 유저 설치 → 어떤 결제</li>
</ul>
<p>위의 내용을 유저 단위로 추적할 수 있었다면, 개인정보 보호가 강해지면서 위의 방식이 불가능해졌다.
따라서, 애플이 허용하는 범위안에서만 광고 성과를 알려주는 시스템 즉,<strong>SKAN을 통해 광고주는 광고활동(노출, 클릭, 앱 설치)을 개별적 기록이 아닌 집약된 정보로 측정</strong>할 수 있게 되었다.(유저 데이터를 익명화된 코호트로 그룹화하는 식으로 개별 프로파일링을 방지)</p>
<ul>
<li><p>SKAN 4.0과 AdAttributionKit은 2일, 7일, 35일의 사전 정의된 시간에 맞춰 3개의 포스트백을 제공하도록 규정</p>
</li>
<li><p>ATT 프레임워크란?
사용자의 데이터를 공유하기 위해 모든 iOS 앱이 사용자에게 허가를 요청하도록 유구하는 Apple의 선택 기반 개인정보 보호 프레임워크
(앱 실행 때 나오는 추적 허용하겠습니까?)</p>
</li>
<li><p>AdAttributionKit?
개인 정보 보호를 우선시하는 어트리뷰션 방식을 사용하면, 리포트 데이터가 특정 개인과 연결되는 것을 방지하고자 데이터를 실시간으로 전송하지 않는다</p>
</li>
<li><p>MMP Attribution(모바일 측정 파트너)
앱이 광고 마켓팅 채널, 미디어 소스, 애드 네트워크 전반에서 캠페인 성과를 측정하도록 돕는 회사</p>
</li>
</ul>
<h4 id="skan의-핵심-개념-3가지">SKAN의 핵심 개념 3가지</h4>
<ol>
<li><p>Postback (포스트백) :
웹사이트, 네트워크 또는 앱에서의 유저 행동을 보고하기 위해 서버 간 정보를 교환
즉, 애플이 광고 네트워크(구글/메타 등)에게 보내주는 성과 리포트
포스트백에는 개인 식별 정보가 없음 (“누가 샀는지”가 아니라 “몇 명이 이런 행동을 했다” 수준)</p>
<blockquote>
<p><img src="https://velog.velcdn.com/images/adam_ham/post/6daceb22-c8b7-4aa8-a093-b63990dbb667/image.png" alt="출처 : 앱스플라이어 포스트백 관련 글"> 출처 : 앱스플라이어 포스트백 관련 글</p>
</blockquote>
</li>
<li><p>Attribution
광고 기여도</p>
</li>
<li><p>Conversion Value</p>
</li>
</ol>
<ul>
<li>미세 전환값 (Fine-grained Value): 0~63까지의 기존 값으로, 높은 군중 익명성이 충족될 때(많은 설치 수) 구체적인 인앱 이벤트 데이터를 제공합니다.</li>
<li>거친 전환값 (Coarse-grained Value): Low, Medium, High 3단계로 구분됩니다. 설치 수가 적어 익명성이 확보되지 않을 때(낮은 티어)에도 0 대신 3단계 중 하나의 성과를 받아볼 수 있어 소규모 캠페인 분석에 유리합니다. <blockquote>
<p><img src="https://velog.velcdn.com/images/adam_ham/post/828bcb36-676b-4aaf-9ba7-73e411b7e7d5/image.png" alt="">출처 : MOLOCO</p>
</blockquote>
</li>
</ul>
<blockquote>
<h4 id="참고링크">참고링크</h4>
<p>포스트백(앱스플라이어) <a href="https://www.appsflyer.com/ko/glossary/postback/">(LINK)</a>
SKAN과 샌드박스(앱스플라이어) <a href="https://www.appsflyer.com/ko/blog/measurement-analytics/skan-vs-sandbox/">(LINK)</a>
ROAS(앱스플라이어) <a href="https://www.appsflyer.com/ko/glossary/roas/">(LINK)</a>
SKANSetup(Moloco)[(LINK)] (<a href="https://help.moloco.com/hc/en-us/articles/30060034592919-How-to-set-up-SKAdNetwork-SKAN-attribution-for-iOS-apps">https://help.moloco.com/hc/en-us/articles/30060034592919-How-to-set-up-SKAdNetwork-SKAN-attribution-for-iOS-apps</a>)</p>
</blockquote>
]]></description>
        </item>
        <item>
            <title><![CDATA[E-mail(PDF) LLM Parsing]]></title>
            <link>https://velog.io/@adam_ham/E-mailPDF-LLM-Parsing</link>
            <guid>https://velog.io/@adam_ham/E-mailPDF-LLM-Parsing</guid>
            <pubDate>Tue, 23 Jul 2024 07:58:47 GMT</pubDate>
            <description><![CDATA[<pre><code class="language-python">prompt = PromptTemplate.from_template(&quot;&quot;&quot;
Parse the following email text and extract the information in a structured format.
Return the result as a Python dictionary, without any additional text or formatting

Email text:
{email_text}

Extract the following information:
- Key 1
- Key 2
- Key 3
- Key 4

Format the dates as YYYY-MM-DD HH:MM.
&quot;&quot;&quot;)


# Create the chain
parse_chain = (
    {&quot;email_text&quot;: RunnablePassthrough()}
    | prompt
    | llm
    | StrOutputParser()
)

def parse_llm_output(output: str) -&gt; Dict:
    # First, try to parse as a Python literal
    try:
        # Remove any leading/trailing whitespace and the &quot;booking_info =&quot; part if present
        clean_output = output.strip().replace(&quot;ID_of_data&quot;, &quot;&quot;).strip()
        return ast.literal_eval(clean_output)
    except (ValueError, SyntaxError):
        pass

    # If that fails, try to parse as JSON
    try:
        return json.loads(output)
    except json.JSONDecodeError:
        pass

    # If both methods fail, try to manually parse the string
    try:
        # Remove curly braces and split by commas
        items = output.strip(&#39;{}&#39;).split(&#39;,&#39;)
        result = {}
        for item in items:
            key, value = item.split(&#39;:&#39;, 1)
            key = key.strip().strip(&#39;&quot;&#39;)  # Remove quotes and whitespace
            value = value.strip().strip(&#39;&quot;&#39;)  # Remove quotes and whitespace
            result[key] = value
        return result
    except Exception as e:
        print(f&quot;Error parsing LLM output: {e}&quot;)
        print(f&quot;Problematic output: {output}&quot;)
        return {}

def process_pdf_and_parse_email(pdf_path: str) -&gt; dict:
    email_text = extract_text_from_pdf(pdf_path)
    parsed_output = parse_chain.invoke(email_text[0].page_content)
    return parse_llm_output(parsed_output)


process_pdf_and_parse_email(data)</code></pre>
]]></description>
        </item>
        <item>
            <title><![CDATA[LLM AGENT 참고 내용 및 링크 정리(1)]]></title>
            <link>https://velog.io/@adam_ham/%EC%B0%B8%EA%B3%A0-%EB%A7%81%ED%81%AC-%EC%A0%95%EB%A6%AC</link>
            <guid>https://velog.io/@adam_ham/%EC%B0%B8%EA%B3%A0-%EB%A7%81%ED%81%AC-%EC%A0%95%EB%A6%AC</guid>
            <pubDate>Tue, 23 Jul 2024 07:53:16 GMT</pubDate>
            <description><![CDATA[<h4 id="how-to-build-agent-without-langchain-scott-logic">How to build Agent Without Langchain <a href="https://blog.scottlogic.com/2024/06/28/building-a-multi-agent-chatbot-without-langchain.html">(Scott Logic)</a></h4>
<ul>
<li>랭체인과 랭그래프를 사용하던 와중, 파이프라인에 대한 이해 부족과 구현의 필요성을 느꼈고 이를 랭체인과 랭그래프 플랫폼 외부에서 찾아보고자 했다.
<img src="https://velog.velcdn.com/images/adam_ham/post/9b61211e-4712-400b-83e4-943cb90648b1/image.png" alt=""><h5 id="key-flow">Key Flow</h5>
</li>
<li>Controller: The entry point to the backend, where we set up our chat endpoint via FastAPI. The chat endpoint delegates to the director to get the response for the user.</li>
<li>Director: No LLM involved. The director handles the user’s query, breaking it down into solvable questions for the supervisor and returning the final response to the - controller.</li>
<li>Intent Agent: An LLM call is used to break up the user’s original query into its intent, ensuring more reliable and repeatable results.</li>
<li>Supervisor: No LLM involved here. The supervisor loops through the questions it needs to solve:</li>
<li>Router: Decides the best next step. With a list of available agents, the current task to solve, and the history of results, the router makes an LLM call to decide which agent should solve the task.</li>
<li>Available Agents: The supervisor invokes the chosen agent to get a response. For example, a datastore agent would be chosen for a data-driven question. It would then use an LLM to generate a Cypher query to retrieve the data and return the response to the supervisor.</li>
<li>Validator Agent: With a response from the question agent, the supervisor checks with the validator agent if the answer is sufficient. An LLM call is used to determine whether the answer is satisfactory.</li>
<li>Scratchpad: A simple object that the supervisor uses to record every answer to each question.</li>
<li>Answer Agent: With each result written to the scratchpad, the director can then invoke the answer agent to summarise the scratchpad, resulting in the final response for the user.</li>
</ul>
<h3 id="definition-of-llm-medium-blog">Definition of LLM <a href="https://medium.com/@aydinKerem/what-is-an-llm-agent-and-how-does-it-work-1d4d9e4381ca">(Medium Blog)</a></h3>
<p><img src="https://velog.velcdn.com/images/adam_ham/post/f47e0997-e0bc-4363-886c-3d6d90de3193/image.png" alt=""></p>
<h3 id="agents-orchestration-medium-blog">Agents Orchestration <a href="https://medium.com/scisharp/understand-the-llm-agent-orchestration-043ebfaead1f">(Medium Blog)</a></h3>
<p><img src="https://velog.velcdn.com/images/adam_ham/post/be3fd274-964d-4c18-bf57-0aaa4b4751ec/image.png" alt=""></p>
<blockquote>
<p>REFERENCE</p>
</blockquote>
<ul>
<li>Building a Multi Agent Chatbot Without LangChain (ScottLogic)</li>
<li>What is an LLM Agent and how does it work? (Blogpost by Keremaydin)</li>
<li>Understand the LLM Agent Orchestration (Blogpost by Haiping Chen)</li>
</ul>
<blockquote>
<p>USEFUL LINKS</p>
</blockquote>
<ul>
<li>Github 협업 참고 - 공부하는 개발자 강씨네 <a href="https://12716.tistory.com/entry/Git-GitHub-%ED%98%91%EC%97%85%ED%95%98%EA%B8%B0">(Link)</a></li>
<li>SQL_AGENT Workflow <a href="https://github.com/JayZeeDesign/sql-agent">(Link)</a></li>
</ul>
]]></description>
        </item>
        <item>
            <title><![CDATA[Create SQL Agent 작성시 Template 작성법]]></title>
            <link>https://velog.io/@adam_ham/Create-SQL-Agent-%EC%9E%91%EC%84%B1%EC%8B%9C-Template-%EC%9E%91%EC%84%B1%EB%B2%95</link>
            <guid>https://velog.io/@adam_ham/Create-SQL-Agent-%EC%9E%91%EC%84%B1%EC%8B%9C-Template-%EC%9E%91%EC%84%B1%EB%B2%95</guid>
            <pubDate>Mon, 22 Jul 2024 04:36:58 GMT</pubDate>
            <description><![CDATA[<pre><code class="language-python">from langchain_core.prompts import (
    ChatPromptTemplate,
    FewShotChatMessagePromptTemplate,
    PromptTemplate,
)

from langchain.agents.mrkl import prompt as react_prompt

examples = [
    {&quot;input&quot;: &quot;List all schedules.&quot;, &quot;query&quot;: &quot;SELECT * FROM table;&quot;},
    {
        &quot;input&quot;: &quot;Find all delayed schedules.&quot;,
        &quot;query&quot;: &quot;SELECT * FROM table WHERE Delayed &gt; 0;&quot;,
    }
]

system_prefix = &quot;&quot;&quot;
    You are an agent designed to interact with a SQL database.
    Given an input question, create a syntactically correct query to run, then look at the results of the query and 
    return the answer. Unless the user specifies a specific number of examples they wish to obtain.
    You can order the results by a relevant column to return the most interesting examples in the database.
    Never query for all the columns from a specific table, only ask for the relevant columns given the question.
    You have access to tools for interacting with the database.
    Only use the given tools. Only use the information returned by the tools to construct your final answer.
    You MUST double check your query before executing it. If you get an error while executing a query, rewrite the query 
    and try again.

    DO NOT make any DML statements (INSERT, UPDATE, DELETE, DROP etc.) to the database.
    You have access to the following tables:
    {table_info}
    Never access to unmentioned tables.
    If the question does not seem related to the database, just return &quot;I don&#39;t know&quot; as the answer.
&quot;&quot;&quot;

basic_suffix = &quot;&quot;&quot;
    Begin!

    Question: {input}
    table : {table_info}
    Thought: I should look at the tables in the database to see what I can query. Then I should query the schema of the most relevant tables.\n
    {agent_scratchpad}

&quot;&quot;&quot;

example_prompt = ChatPromptTemplate.from_messages(
    messages=[
        (&#39;human&#39;, &quot;{input}&quot;),
        (&#39;ai&#39;, &quot;{query}&quot;)
    ]
)

few_shot_prompt = FewShotChatMessagePromptTemplate(
    examples=examples,
    example_prompt=example_prompt,
    input_variables=[&quot;input&quot;,
                     &quot;agent_scratchpad&quot;],
)

format_instructions = f&quot;{react_prompt.FORMAT_INSTRUCTIONS}\n &quot; \
                      f&quot;Here are some examples of user inputs and &quot; \
                      f&quot;their corresponding SQL queries:\n&quot;

template = &quot;\n\n&quot;.join(
    [
        system_prefix.format(table_info =  &quot;table&quot;),
        &quot;{tools}&quot;,
        format_instructions,
        few_shot_prompt.format(),
        basic_suffix
    ]
)

prompt = PromptTemplate.from_template(template=template)

# Create the SQL toolkit
toolkit = SQLDatabaseToolkit(db=db, llm=llm)

# Create the SQL agent
agent = create_sql_agent(
    llm=llm,
    toolkit=toolkit,
    verbose=True,
    prompt = prompt
)

agent.run(&quot;what are the delayed schedules?&quot;)</code></pre>
<blockquote>
<p>Reference
<a href="https://github.com/langchain-ai/langchain/issues/17939">https://github.com/langchain-ai/langchain/issues/17939</a>
<a href="https://data-newbie.tistory.com/965#pipeline">https://data-newbie.tistory.com/965#pipeline</a></p>
</blockquote>
]]></description>
        </item>
        <item>
            <title><![CDATA[Explainability? Interpretability?]]></title>
            <link>https://velog.io/@adam_ham/Explainability-Interpretability</link>
            <guid>https://velog.io/@adam_ham/Explainability-Interpretability</guid>
            <pubDate>Sun, 02 Jun 2024 13:49:20 GMT</pubDate>
            <description><![CDATA[<p>최근 프로젝트 관련하여 XAI를 적용하고자 하는데,Explainable AI에 대한 정확한 이해가 없는 것 같아서, 이번 기회에 공부해보고자 한다.</p>
<h3 id="그래서-xai가-뭐야-왜-필요해">그래서 XAI가 뭐야? 왜 필요해?</h3>
<p>XAI란 Machine Learning 과정에서 모델이 내리는 각 결정을 추적하고 설명할 수 있도록 하는 특정 기법과 방법들을 의미한다.
<img src="https://velog.velcdn.com/images/adam_ham/post/aaa8a891-d71d-4fdf-8e53-accd7554a60d/image.png" alt=""></p>
<h4 id="xai의-목적">XAI의 목적</h4>
<p>XAI의 목적은 복잡하게 얽혀있어서, 무엇에 대해(what), 어떤 방법론으로(how), 얼마나 설명할 것인가 등, 여러 요소와 상황에 따라 달라지기 때문에 명확하게 정의하기는 어렵다. 따라서, [3]의 내용을 바탕으로 큰 틀에서 접근해보고자 한다.</p>
<h5 id="explainability">Explainability</h5>
<p>의사결정자의 정확한 대리자이면서도 모델의 기능을 청자(audience)에게 명확히 이해하기 쉽도록 세부 사항이나 이유를 생성하는 모델의 <strong>능동적인</strong> 특성.</p>
<h5 id="interpretability">Interpretability</h5>
<p>모델이 인간에게 얼마나 의미가 있는지의 정도(level)를 나타내는 모델의 <strong>수동적 특성</strong>.  모델이 해석가능(interpretable) 하다는 것은 사용자가(user) 모델의 입력부터 출력까지의 과정을 수학적으로 표현까지 가능하다는 것이다.</p>
<h5 id="trustworthiness">Trustworthiness</h5>
<p>문제가 주어졌을 때, 모델이 의도한대로 작동하는가를 나타낸다. 모델의 결정을 이해할 수 있을 때, 우리는 모델을 믿고 사용할 수 있다.</p>
<h5 id="interactivity">Interactivity</h5>
<p>유저와의 상호 작용은 XAI의 목표중 하나이다. 이러한 상호 작용들은 [2]에서 말하는 여러가지 관점들에 따라 정해질 수 있다고 생각한다.</p>
<p><img src="https://velog.velcdn.com/images/adam_ham/post/98175ff7-6e81-495e-8322-49e66f6a1ba5/image.png" alt=""></p>
<h5 id="stability--robustness">Stability &amp; Robustness</h5>
<p>센서에서 올 수 있는 노이즈라던가, 현실 세계에서 발생할 수 있는 작은 변화들에 민감하지 않다는 것은 그 모델이 안정적(stable)이라는 것이다. 이와 반대로, 모델이 사람에 의해 의도적으로 발생시킨 노이즈를 견딘다는 것은 그 모델이 견고하다(robust)는 것이다.</p>
<blockquote>
</blockquote>
<h4 id="reference">Reference</h4>
<p><a href="https://www.ibm.com/topics/explainable-ai">[1] What is explainable AI?</a>
<a href="https://www.sciencedirect.com/science/article/pii/S0950705123000230">[2] Explainable AI (XAI): A systematic meta-survey of current challenges and future opportunities</a>
[3] Explainable Artificial Intelligence (XAI) on Time Series Data: A Survey
<a href="https://velog.io/@kyyle/Explainable-Artificial-Intelligence-XAI-on-Time-Series-Data-A-Survey#purposes-of-explainability-methods-for-time-series">번역 및 정리(Kyyle님의 블로그)</a>, <a href="https://arxiv.org/abs/2104.00950">논문</a></p>
]]></description>
        </item>
        <item>
            <title><![CDATA[논문 회고]]></title>
            <link>https://velog.io/@adam_ham/%EB%82%B4-%EB%85%BC%EB%AC%B8-%EB%A6%AC%EB%B7%B0%ED%95%B4%EB%B3%B4%EA%B8%B0</link>
            <guid>https://velog.io/@adam_ham/%EB%82%B4-%EB%85%BC%EB%AC%B8-%EB%A6%AC%EB%B7%B0%ED%95%B4%EB%B3%B4%EA%B8%B0</guid>
            <pubDate>Mon, 15 Apr 2024 12:33:04 GMT</pubDate>
            <description><![CDATA[<h2 id="요약">요약</h2>
<p>논문은 분자 특성 예측을 위한 새로운 방법인 Evidential Meta-model for Molecular Property Prediction (EM3P2)을 제안한다. 이 방법은 예측과 함께 불확실성 추정을 제공할 수 있는 능력을 가지고 있다. EM3P2는 Model Agnostic Meta-Learning (MAML) 프레임워크 아래의 few-shot 메타 학습 접근법을 사용하며, query balancing과 같은 데이터 불균형 처리 기법을 결합한다.
EM3P2의 주요 구성 요소는 다음과 같다:</p>
<ul>
<li>분자 그래프 및 노드 임베딩을 위한 Graph Isomorphism Network (GIN)</li>
<li>분류를 위한 Evidential Multi-Layer Perceptron (EMLP), 이는 단순한 클래스 확률이 아닌 증거 벡터를 출력한다.</li>
<li>불확실성 추정을 개선하기 위한 belief regularization과 accuracy vs uncertainty regularization 같은 기법들</li>
</ul>
<p>EM3P2는 Tox21, SIDER, MUV와 같은 데이터셋에서 분자 특성 예측을 위한 기존의 메타 학습 및 메트릭 학습 기준선보다 더 나은 성능을 보인다. 불확실성 추정을 사용하여 신뢰도가 낮은 예측을 거부함으로써 전반적인 정확도를 향상시킬 수 있다는 것을 보여준다. 결과적으로, 논문은 EM3P2가 적은 수의 불균형 데이터에서 학습할 수 있고, 새로운 작업에 잘 적응하며, 신뢰할 수 있는 불확실성 측정을 제공할 수 있어, 약물 발견을 가속화하고 안전에 중요한 응용 프로그램에서 신뢰성을 향상시키는 데 유용한 능력을 갖추고 있다고 강조한다.</p>
<h2 id="잘한점">잘한점</h2>
<ul>
<li>Meta-learning Training inference과정에서 query sampling이 biased training에 영향을 미친다는 점을 찾아냄</li>
<li>Graph Neural Network와 Meta-learning 프레임워크 내에 ENN을 적용시켜 데이터의 불확실성 측정</li>
<li>Belief theory 관점에서의 접근을 잘 활용함</li>
</ul>
<h2 id="아쉬운-점--future-work">아쉬운 점 &amp; Future Work</h2>
<ul>
<li>다른 graph neural network를 썼을 때의 성능 비교가 없음</li>
<li>Parameter Tuning의 Detail이 부족</li>
<li>극심한 Bias 환경 내에서는 아직도 약한 모습을 보임</li>
<li>Uncertainty를 이용한 모델 발전 가능성이 보임(ex. Active Learning)</li>
</ul>
<blockquote>
</blockquote>
<h3 id="reference">Reference</h3>
<p>Evidential meta-model for molecular property prediction(<a href="https://academic.oup.com/bioinformatics/article/39/10/btad604/7320005">Paper</a>,<a href="https://github.com/Ajou-DILab/EM3P2">Code</a>)</p>
]]></description>
        </item>
        <item>
            <title><![CDATA[Evidential Deep Learning to Quantify Classification
Uncertainty]]></title>
            <link>https://velog.io/@adam_ham/Evidential-Deep-Learning-to-Quantify-ClassificationUncertainty</link>
            <guid>https://velog.io/@adam_ham/Evidential-Deep-Learning-to-Quantify-ClassificationUncertainty</guid>
            <pubDate>Tue, 02 Apr 2024 07:26:57 GMT</pubDate>
            <description><![CDATA[<h1 id="enn-과-subjective-logic">ENN 과 Subjective Logic</h1>
<p>우리가 흔히 아는 전통적인 로직은 어떤 명제에 대해 참, 거짓의 이분법적인 방법으로 접근을 합니다. 예를 들어, &quot;밖에 비가 오고 있다.&quot;라고 했을 때, 우리는 맞아, 틀렸어라고 대답을 하는 것이죠. 하지만, 실생활에서 우리가 마주하는 상황들은 불완전하거나 &quot;불확실&quot;합니다. 예를 들어, &quot;내일은 비가 올거야&quot;라는 이야기를 했을 때, 우리는 이게 맞는지 틀린지 확신할 수 없습니다. 즉, 이 명제에 대해 &quot;불확실성&quot;이 존재합니다.</p>
<p>Probabilistic Logic은 이런 &quot;불확실성&quot;을 염두해 두고 추론을 하는 방법입니다. &quot;날씨가 흐린 것을 보니, 내일 70%의 확률로 비가 올거야&quot;라고 이야기하는 것처럼, 우리가 가진 어떤 정보를 통해 특정 명제에 대한 믿음의 정도(Belief) 또는 불확실성(Uncertainty)을 제시하고 이를 확률적으로 표현합니다.</p>
<p>Subjective Logic은 앞서 언급한 Probabilistic Logic의 한 종류로, 정보의 조각들 또는 의견(Opinion)들에 대한 belief들과 불확실성에 대해 디리클레의 분포(Dirichlet Distribution)를 사용한 벡터로써 표현합니다. 그리고, 각각의 belief들과 uncertainty mass의 합은 1을 만족합니다. 이를 식으로 표현하면 다음과 같습니다.
$$
\begin{aligned}
&amp;given;mutally;exclusive;\
&amp;singleton;k=1,;...;,K\
&amp;\quad\quad u+\sum_{k=1}^{K}{b_{k}}=1\
\end{aligned}
$$
이 때, $u\geq0,;b_k\geq0$ 이고, belief mass는 singleton에 대한 <strong>evidence</strong>를 통해 계산이 됩니다.</p>
<p>그럼 여기서, ENN 모델의 역할은 무엇일까요?
ENN 모델의 학습은 결국 주어진 데이터로부터 belief mass를 계산하기 위한 evidence를 수집하는 과정이라고 볼 수 있습니다. Classification task의 경우, $K$는 각 class에 해당하고, $b_k$는 각 class에 대해 다음과 같이 evidence를 이용하여 belief mass를 추정하게 됩니다.
$$
b_k = \frac{e_k}{\sum_{k=1}^{K}{e_{k}+1}},; v=\frac{K}{\sum_{k=1}^{K}{e_{k}+1}},; e_k\geq0
$$
또한, probability로 나타내기 위해, $\alpha$라는 하나의 파라미터를 이용하여, $\alpha_k = e_k+1$로 설정하고, 각 class에 대한 probability를 $\frac{\alpha_k}{\sum_{k=1}^{K}{e_{k}+1}}$로 할당합니다.</p>
<p>결론적으로 ENN을 썼을 때의 장점은 다음과 같습니다.</p>
<ol>
<li>Softmax function에 의해 생성된 class probability를 Dirichlet distribution으로 바꿈으로써, softmax function이 야기하는 probability inflation 현상을 줄일 수 있다.</li>
<li>마지막 softmax 레이어를 non-negative activation layer로 바꿈으로써, 일반적인 뉴럴네트워크 모델에 쉽게 적용시킬 수 있어, 기존의 Bayesian Neural Network들보다 연산적으로 효율적이다.</li>
<li>데이터에 uncertainty를 할당하고 &quot;I don&#39;t know state&quot;를 활용하여, 아래의 오른쪽 그림과 같이 모델의 데이터에 대한 불확실성을 나타낸다.</li>
</ol>
<p><img src="https://velog.velcdn.com/images/adam_ham/post/883aecd3-5bd3-411d-a992-3bcc1aeb8a61/image.png" alt=""></p>
<blockquote>
</blockquote>
<h2 id="reference">Reference</h2>
<p><a href="https://www.duo.uio.no/bitstream/handle/10852/72014/JCC2018-FUSION.pdf?sequence=1&amp;isAllowed=y">Uncertainty Characteristics of Subjective Opinions</a>
<a href="https://browse.arxiv.org/pdf/2203.12768">Multidimensional Belief Quantification for Label-Efficient Meta-Learning</a>
<a href="https://openaccess.thecvf.com/content/ICCV2021/papers/Bao_Evidential_Deep_Learning_for_Open_Set_Action_Recognition_ICCV_2021_paper.pdf">Evidential deep learning for open set action recognition</a>
<a href="https://arxiv.org/abs/1806.01768">Evidential Deep Learning to Quantify Classification Uncertainty</a></p>
]]></description>
        </item>
        <item>
            <title><![CDATA[GNN & Types of Normalization]]></title>
            <link>https://velog.io/@adam_ham/GNN-Types-of-Normalization</link>
            <guid>https://velog.io/@adam_ham/GNN-Types-of-Normalization</guid>
            <pubDate>Fri, 29 Mar 2024 08:07:50 GMT</pubDate>
            <description><![CDATA[<p><img src="https://velog.velcdn.com/images/adam_ham/post/3868a59c-388a-4db7-87f6-7aabd889742c/image.png" alt="image from Cai et.al"></p>
<h1 id="how-does-normalization-help-dnn-training">How does Normalization help DNN training?</h1>
<ul>
<li><strong>Stabilizing Activation Distributions</strong></li>
<li><strong>Faster Convergence</strong></li>
<li><strong>Regularization</strong></li>
<li><strong>Enabling Larger Learning Rates</strong></li>
<li><strong>Reducing Internal Covariate Shift</strong></li>
<li><strong>Making Networks Robust to Initialization</strong></li>
<li><strong>Reducing Gradient Vanishing/Exploding</strong></li>
</ul>
<h2 id="batch-normalization">Batch Normalization</h2>
<h4 id="a-mechanism-that-aims-to-stabilize-the-distribution-over-a-mini-batch-of-inputs-to-a-given-network-layer-during-training"><strong>A mechanism that aims to stabilize the distribution over a mini-batch of inputs to a given network layer during training.</strong></h4>
<ul>
<li>augment the network w/ additional layers that set mean&amp;variance of the distribution of each activation to be zero and one respectively.</li>
<li>batch normalized inputs can be scaled and shifted based on trainable parameters to preserve model expressivity.</li>
<li>applied before non-linearity of previous layer</li>
</ul>
<h2 id="-what-is-the-benefit-">** What is the benefit? **</h2>
<h4 id="faster-convergence"><strong>Faster Convergence</strong></h4>
<p>BatchNorm <del>reduces internal covariate shift</del>, which leads to more stable gradients and faster convergence during training. This can lead to shorter training times and require fewer training epochs.</p>
<p>→ makes the landscape of the corresponding optimization problem 
    significantly smooth : </p>
<ul>
<li><p>ensure that gradients are more predictive → gradient direction remains fairly accurate when taking larger step in a direction of a computed gradient</p>
</li>
<li><p>allows for use of larger range of learning rates and faster network convergence</p>
</li>
<li><p>improved Lipschitzness(ß-smoothness) of both the loss &amp; gradients</p>
</li>
</ul>
<p>↔ non-convex, flat region, sharp minima</p>
<ul>
<li><p>convex 함수의 경우, 우리가 딥러닝에서 경사 하강법을 통해 찾는 최저점이 단 하나 존재한다. 이 점을 전역 최적해Global Minimum이라고 한다.</p>
</li>
<li><p>non-convex 함수는 무한히 넓은 함수 공간에서 여러 곳의 지역 최저점 Local minima을 갖는다. 위 함수에서 이로 인하여, 경사 하강법을 시작하는 위치에 따라 서로 다른 최저점을 향해 결과가 수렴하게 된다. non-convex 함수의 문제는 우리가 어디가 전역 최적해인지를 알 수가 없다는 것이다. 이로 인해 non-convex 한 문제를 딥러닝으로 해결하려고 하면 학습이 잘 되지 않고 좋지 않은 지역 최저점에 갇히는 등의 문제가 발생한다.</p>
</li>
<li><p>ICS : the change in the distribution of layer inputs caused by updates to the preceding layers.</p>
</li>
</ul>
<h4 id="regularization"><strong>Regularization</strong>:</h4>
<p>BatchNorm acts as a form of regularization, reducing the need for other regularization techniques like dropout. It can mitigate overfitting to some extent.</p>
<h4 id="increased-learning-rates"><strong>Increased Learning Rates</strong></h4>
<p>BatchNorm allows for the use of higher learning rates without the risk of causing divergence or instability in the training process.</p>
<h4 id="network-robustness"><strong>Network Robustness</strong></h4>
<p>BatchNorm can make neural networks more robust to changes in initialization and architecture choices. less sensitive to hyperparameter choices</p>
<h4 id="prevention-of-exploding-or-vanishing-gradients"><strong>Prevention of exploding or vanishing gradients</strong></h4>
<h2 id="layer-normalization">Layer Normalization</h2>
<h4 id="layer-normalization-works-well-for-rnns-and-improves-both-the-training-time-and-the-generalization-performance-of-several-existing-rnn-models">Layer normalization works well for RNNs and improves both the training time and the generalization performance of several existing RNN models.</h4>
<p><strong>Batch Norm</strong> in RNN can be problematic because we need to compute and store separate statistics for each time step in a sequence &amp; when the length of sequence is different for test cases. On the other hand, <strong>Layer Norm</strong> depend only on the summed inputs to a layer at the current time-step &amp; has only one set of gain and bias parameters shared over all time-steps.</p>
<h4 id="in-layer-norm-all-the-hidden-units-in-a-layer-share-the-same-normalization-terms-µ--σ-but-different-training-cases-have-different-normalization-terms-covariate-shift-problem-can-be-reduced-by-fixing-the-mean-variance-of-the-summed-inputs-in-the-same-layer">In <strong>Layer Norm</strong>, all the hidden units in a layer share the same normalization terms <strong>µ</strong> &amp; <strong>σ</strong> but different training cases have different normalization terms. ‘covariate shift’ problem can be reduced by fixing the mean, variance of the summed inputs in the same layer:</h4>
<p>According to Xiong et.al</p>
<ol>
<li><p>learning-rate warm up stage is essential ?</p>
<p>Original-designed Post-LN Transformer places the layer normalization between the residual blocks
→ expected gradients of the parameters near the output layer are large
→ Using large learning rate on the gradients make training unstable</p>
</li>
<li><p>location of layer normalization matters ?</p>
<p> If the layer-normalization is put inside the residual blocks
 (Pre-LN Transformer), the gradients are well-behaved at initialization</p>
<p> → remove warm up stage</p>
</li>
</ol>
<h2 id="instance-normalization">Instance Normalization</h2>
<p>started from real-time image generation / style transfer</p>
<h2 id="graph-normalization">Graph Normalization</h2>
<p>Instance Norm serves as a pre-conditioner(for graph aggregation) for GNNs.
Preconditioning is weaker with Batch Norm due to heavy batch noise in graph dataset : larger variance of batch-level statistics on graph dataset .
Shift operation in Instance Norm(subtracts the mean statistics from node hidden representations) has expressiveness degradation of GNNs for highly regular graphs - removing mean statistics  that has structural information can hurt the performance</p>
<h4 id="representation-of-normalization-layerafter-the-linear-transformation">Representation of normalization layer(after the linear transformation)</h4>
<p>$H^{(k)} = F^{(k)}(Norm(W^{(k)}H^{(k-1)}Q))$</p>
<p>$F^{(k)}$ : function that applies to each node separately</p>
<p>$Q$ : $n*n$ matrix representing the neighbor aggregation</p>
<p>$W^{(k)}$ : weight/parameter matrix in layer k</p>
<ul>
<li>$F^{(k)}$ : ReLU ,  $Q_{GCN}$ → GCN with normalization</li>
<li>$F^{(k)} : MLP^{(k)}$, $Q_{GIN}$ → GIN with normalization</li>
</ul>
<hr>
<blockquote>
</blockquote>
<h4 id="reference">Reference</h4>
<p><a href="https://arxiv.org/abs/1502.03167">Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift</a>
<a href="https://arxiv.org/abs/1607.06450">Layer Normalization</a>
<a href="https://arxiv.org/pdf/1607.08022.pdf">Instance Normalization: The Missing Ingredient for Fast Stylization</a>
<a href="https://arxiv.org/abs/2009.03294">GraphNorm: A Principled Approach to Accelerating Graph Neural Network Training</a>
<a href="https://arxiv.org/abs/2002.04745">On Layer Normalization in the Transformer Architecture</a></p>
]]></description>
        </item>
    </channel>
</rss>