DOI: 10.5061/dryad.hdr7sqvrs
title: Data from: A normative framework dissociates need and motivation in hypothalamic neurons

description: Physiological needs evoke motivational drives to produce natural behaviors
 for survival. In previous studies, the temporally intertwined dynamics of
 need and motivation have made it challenging to differentiate these two
 components. Based on classic homeostatic theories, we established a
 normative framework to derive computational models for need-encoding and
 motivation-encoding neurons. By combining the model-based predictions and
 naturalistic experimental paradigms, we demonstrated that AgRP and LHLepR
 neuronal activities encode need and motivation, respectively. Our model
 further explains the difference in the dynamics of appetitive behaviors
 induced by optogenetic stimulation of AgRP or LHLepR neurons. Our study
 provides a normative modeling framework that explains how hypothalamic
 neurons separately encode need and motivation in the mammalian brain.
description: All data were analyzed using the custom-made script in MATLAB
 2022B. Python3 was used for CEBRA analysis.
description: # Data from: A normative framework dissociates need and motivation in
 hypothalamic neurons ## Overview: This project provides the analysis and
 fitting scripts used to generate figures and results for the paper titled
 "A Normative Framework Dissociates Need and Motivation in
 Hypothalamic Neurons". It includes both full model fitting scripts
 and a tutorial folder to help users understand the underlying fitting
 mechanisms. ## Prerequisites: MATLAB: Ensure you have MATLAB installed
 (version 2019b or later is recommended). Toolboxes: Optimization Toolbox
 (for fitting functions like fmincon), Statistics and Machine Learning
 Toolbox (for cross-validation and statistical analyses) Parallel
 Processing Toolbox Data: The scripts assume that the required neural data
 and model inputs are available in the specified directories. libkm :
 ([https://github.com/HRKimLab/libkm](https://github.com/HRKimLab/libkm))
 Some code was used from this library, and some code was modified (e.g.
 plot_bargrp_friedman.m,plot_barpair_friedman.m). ## Key Files:
 NM_pop_model_fit_all.m This script is the primary file for fitting the
 population model. It generates all figures that result from the model
 fitting. Usage: Simply set the file directories and modify the parameters
 as needed. Each function in the script includes detailed comments
 explaining its purpose and any adjustable settings. ## Data The Data
 folder contains the raw data for all the experiments we did in excel file
 format. For convenience, the mat file is a processed file of the data that
 we will use for model fitting based on the raw data. (In this case, for
 simple experiments, we used the excel file as is, but for more complex
 experiments, this process saves time.) The names inside the Data folder
 are based on the initialized experiment names, so please check the
 NM_pop_model_fit_all.m file to see the detailed experiment information. ##
 kernel The GCaMP6s kernel was applied to account for the temporal dynamics
 and signal diffusion inherent in fiber photometry measurements,
 compensating for the gradual spread and decay of the calcium signal. ##
 function The code used for the overall analysis related to fitting.
 Information related to the codes is available inside the code, and we
 encourage you to contact us if you have any questions. Most of the
 functions are performed by built-in functions and code from the Toolboxes,
 with some libkm code. ## results This is the folder that stores the
 results of each of the analytics below. Plots for neuronal population
 activity, AIC (Akaike information criterion) and other performance
 metrics, Visualizations of need and motivation models ## Tutorial Folder
 #### Purpose: The tutorial folder provides a basic introduction to the
 fitting procedure, step by step. It's designed to help you understand
 how the model works, how the fitting process is carried out, and to gain
 hands-on experience with simplified examples. #### Recommendation: If
 you're new to the fitting process or want a deeper understanding of
 the mechanisms, we recommend starting with this folder. ## How to Run: Set
 your directories for the data and output figures. Adjust the parameters
 inside NM_pop_model_fit_all.m based on dataset. Refer to the comments for
 guidance on how to configure settings. Run the script in MATLAB. The
 figures generated will be saved in the specified output folder. \#Data Raw
 Data \~dryad_final\dryad\Data\LepR_Search
 \~dryad_final\dryad\Data\AgRP_Search For Test 1 in Fig 2 \ready# behavior
 label 1. SSO &gt; Seeking Initiation 2. Other behavior labels were not
 used \B_# 250 &gt;25 frames * 10 seconds , 125&gt; 25 frames * 5 seconds
 3. SSO# &lt; Trials aligned to Seeking Initiation
 \~dryad_final\dryad\Data\Contact_AgRP\Food_AgRP \~
 Code_RawData\Data\raw_data\new\Contact_LepR\Food For Test 2 in Fig 2
 \ready# behavior label 1. FC &gt; Contact \B_# 250 &gt; 25 frames * 10
 seconds , 125&gt; 25 frames * 5 seconds 2. FC# &gt; Trials aligned to
 Contact \~ dryad_final\dryad\Data\AgRP_FCL \~
 dryad_final\dryad\Data\LepR_FCl For Test 1 in Fig 3 \ready# behavior label
 1. FCl &gt; Inaccessibility \B_# &gt; 25 frames * 10 seconds , 250 &gt; 25
 frames * 10 seconds 2. FCl# &gt; Trials aligned to Inaccessibility
 \~dryad_final\dryad\Data\agrp_photometry\Agrp_Unobtain
 \~dryad_final\dryad\Data\lepr_photometry\LepR_Unobtain For Test 2 in Fig 3
 \ready# behavior label 1. SS2 &gt; Seeking Initiation 2. RU2&gt; Proximate
 to Food 3. RM&gt; Abandon 4. Other behavior labels were not used \B_# 250
 &gt; 25 frames * 10 seconds , 250 &gt; 25 frames * 10 seconds, 375 &gt; 25
 frames * 15 seconds 5. SS2# &gt; Trials aligned to Seeking Initiation for
 Predicted Loss Test 2 \~Code_RawData\Data\raw_data\MPGL_agrp
 \~Code_RawData\Data\raw_data\MPGL_lepr For multi/predicted gain/loss test
 in Fig 4 and Fig S5, S6 \ready# behavior label 1. FO &gt; Accessibility 2.
 FSS &gt; Seeking Initiation 3. FD &gt; Proximate to Food 4. FC &gt;
 Contact \MPGL_agrp_SE_trialtime.mat, \ MPGL_lepr_SE_trialtime.mat &gt; Fig
 4 5. 1 Column &gt; Accessibility 6. 2 Column &gt; Seeking Initiation 7. 3
 Column &gt; Proximate to Food 8. 4 Column &gt; Contact 9. 5 Column &gt;
 Consumption End 10. 6 Column &gt; Inaccessibility 11. Row &gt; Trial
 Number \MPGL_agrp_TA_trialtime.mat \MPGL_lepr_TA_trialtime.mat &gt;
 Fig.S5, S6 12. 1 Column &gt; Accessibility 13. 2 Column &gt; Seeking
 Initiation 14. 3 Column &gt; Proximate to Food 15. 4 Column &gt; Contact
 16. 5 Column &gt; Consumption End 17. 6 Column &gt; Inaccessibility 18.
 Row &gt; Trial Number \AgRP_LLC_individual_trials.mat,
 \LepR_LLC_individual_trials.mat 19. Individual trial neural activity,
 column mice, row, trials \LepR_LLC_trialtime.mat, \AgRP_LLC_trialtime.mat
 20. 1 Column &gt; Accessibility 21. 2 Column &gt; Seeking Initiation 22. 3
 Column &gt; Proximate to Food 23. 4 Column &gt; Contact 24. 6 Column &gt;
 Inaccessibility 25. Row &gt; Trial Number
 \~dryad_final\dryad\Data\agrp_opto Eating-Evoking Test in Fig 5 \NF# 1. 1
 column : laser time start, 2 column: laser duration 2. 3 column : eating
 behavior start, 4 column: eating behavior duration 3. 5 column : eating
 behavior start, 6 column: eating behavior duration \~\agrp_opto_behavior,
 ~\agrp_opto_behavior_60s Data for opto tests
 \~dryad_final\dryad\Data\lepr_opto Eating-Evoking Test in Fig 5
 \LepROPTO_SF_10s_Food 4\. 1 column : laser time start, 2 column: laser
 duration 5\. 3 column : eating behavior start, 4 column: eating behavior
 duration 6\. 5 column : eating behavior start, 6 column: eating behavior
 duration \~\lepr_opto_behavior \~\lepr_opto_behavior_bin30
 \~dryad_final\dryad\Data\AgRP_Discovery
 \~dryad_final\dryad\Data\LepR_Discovery Predicted Loss Test 3 in Fig S2
 \B_# 250 &gt; 25 frames * 10 seconds , 250 &gt; 25 frames * 10 seconds,
 375 &gt; 25 frames * 15 seconds 1. SS# &gt; Trials aligned to Seeking
 Initiation for Predicted Loss Test 2
 \~dryad_final\dryad\Data\lepr_photometry\lepr_motivation_modeling_fitting
 \~dryad_final\dryad\Data\agrp_photometry\agrp_need_modeling_fitting
 \ready# behavior label 1. FO &gt; Accessibility 2. FSS &gt; Seeking
 Initiation 3. FD &gt; Proximate to Food 4. FC &gt; Contact \~
 dryad_final\dryad\cebra+pca Multi Predicted Gain Test in FigS3, S7, S8
 \AgRP_neuron_train_c1, \AgRP_neuron_train_c2, \LepR_neuron_train_c1,
 \LepR_neuron_train_c2 1. Neuronal activity data
 \AGRP_average_trial_behlabels 2. Behavior label used for average trials of
 AgRP neuronal activity \LepR_average_trial_behlabels 3. Behavior label
 used for average trials of AgRP neuronal activity \ready# 4. FO &gt;
 Accessibility Moment 5. FSS &gt; Seeking Moment 6. FD &gt; Proximate to
 Food Moment &gt; 7. FC &gt; Food Contact Moment \B_# 250 &gt; 25 frames *
 10 seconds, 500 &gt; 25 frames * 10 seconds 8. FO# &gt; Trials aligned to
 Accessibility \~dryad_final\dryad\cebra+pca Multi Predicted Gain Test in
 FigS4 \cebra_randomsplitExtraction 1. code for randomly extracting data
 \shufflelabels 2. code for shuffling labels \AgRP_LepR_Cebra_SciAdv.ipynb
 3. python, jupyter script for cebra analysis \AgRP_labels_test,
 \AgRP_labels_train, \AgRP_train_labels_shuffled_label, \LepR_labels_test,
 \LepR \_labels_train, \LepR \_train_labels_shuffled_label 4. Labels for
 cebra analysis \AgRP_allneurons, \AgRP_neuron_train, \AgRP_neurons_test,
 \LepR_allneurons, \LepR_neuron_train, \LepR_neurons_test 5. Neuronal
 activity data for cebra analysis ## Contact: If you have any questions or
 need further clarification, feel free to reach out to us at
 [tiramica@g.skku.edu](mailto:tiramica@g.skku.edu).