Kazuhiko0h
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # macro_analysis ## 試験種別の添削時間、1h辺りの添削工数 <br>(担当:藤井、王) ### 試験種別の添削時間、1h当りの添削工数(評価なし),<br>試験種別の添削時間、1h辺り添削工数、換算時給(評価あり) * 試験種別の添削時間、換算時給を算出、添削者別 * ops,tgt等も利用 * 添削者評価のデータの利用 * こちら側でスキーマ定義を行い、汎用性を高める > LibreOfficeマクロとwebマクロのデータ形式を揃える > > 入力:それぞれのファイル > > 出力のデータ構造 > > | カラム | データ型 | 説明 | > | -------- | -------- | -------- | > | examiner_id | string | 添削者id | > | exam_id | string | 試験種id | > | correction_time | int | 添削時間(秒) | > | correction_date | date | 添削日| > | man_hour | float | 工数 | * 必要な入力は↑のファイルと,スキーマ定義した添削者評価ファイル,工数対応表 出力はこれから考える * 阿部さんとのやり取り 入力のデータ型は何か(dataframe or ファイル名(str) or list or others) > 一番外側のインタフェースとしてはコマンドライン引数でファイルパスを指定する認識です。また、同時に科目、算出する粒度(大学単位, 試験種単位etc)といった必要なパラメータも入力としてコマンドライン引数に入れる必要があるかと思います。作成していく中で外部から入力として受け取っていたものに関してはパラメータとして適宜追加していくとよさそうです。 "1h当たりの添削工数" は試験種ごとに出すという認識で合っているか > 基本は試験種別で出せると良いですが、さらに拡張して大学別、大学×年度別、科目別といった粒度でも出せる形にしていただきたいです。(外部からの入力で粒度を選択) スキーマ定義した添削者評価ファイルのサンプルはあるか(なければ、データ構造のざっくりとした感じを知りたいです) > 前回のmtgの議事録の総添削量試算の部分の添削者評価ファイルのスキーマ定義、添削者評価マスタと同様のものになるかと思います。 添削者評価スキーマ定義 | カラム | データ型 | 説明 | | -------- | -------- | -------- | | examiner_id | string | 添削者id | | evaluation_month | int | 添削者評価月 | | examiner_evaluation_id | int | 添削者評価id | 添削者評価マスタ | カラム | データ型 | 説明 | | -------- | -------- | -------- | | examiner_evaluation_id | int | 添削者評価id | | examiner_evaluation_name | int | 添削者評価 | | basic_correction_fee | int | 基本添削料 | > 内部的にデータをpandasで読み込んで処理をするか、csvモジュールでcsv.DcitReaderで読み込んでdataclass等を作成し処理をしていくかはお任せしますが、出来る限りソフトコーディングを行って汎用性を高めていただきたいです。特にmacro_analysis部分は今後分析の幅を広げる際に拡張していく余地があるので。 > また、それぞれの関数、classのインタフェースの設計が出来た段階で一度自分の方で確認しようと思うのでPRを出していただけると助かります。 * 松田さんとのやりとり 試験種id と試験種名の対応を *`macro_analysis`* フォルダでやろうと思っているのですが... > preprocessの段階でexam_nameを出力のデータに入れるようにします。(macro_analysisはあくまで整形後のデータの「分析」だけを行うのが望ましいと思うので) - input - preproccessed_path - examiner_evaluation_path - output | 返り値 | 想定される粒度 | Column 3 | | -------- | -------- | -------- | | 添削時間 | 大学, 試験種 || | (粒度)ごと添削工数| | | (粒度)ごと時給 | | - 粒度の定義 - 科目>大学>年度>試験種(大問ごと) → preprocessに提案 - 添削者 ``` commandにて $ (試験種) (添削者) > (試験種)--添削者1 --添削者2 --... $ (添削者) (試験種) > (添削者)-- 試験種1 -- 試験種2 -- ... ``` --- - コマンドライン引数の例 `python analysis.py (arg1) (arg2) (arg3) (arg4) ...` `python analysis.py -in (arg1) (arg2) -o (arg3) (arg4)...` ``` python a.py arg1 arg2 arg3 import sys arg1 = sys.argv[1] arg2 = sys.argv[2] arg3 = sys.argv[3] print(type(arg1)) > str ``` ## TODO ●mainの関数で コマンドライン引数を受け取るように対応 ●受け取った順に例の構造を出力するような関数を用意 ●Liveshare ●preprocessで粒度定義するか提案する --- ### 3/10 18:00~ ##### TODO確認 - ~~mainの関数で コマンドライン引数を受け取るように対応~~ - ~~受け取った順に例の構造を出力するような関数を用意~~ - ~~Liveshare~~ - ~~preprocessで粒度定義するか提案する~~ ##### examiner_idに対応する単価(unit)を`examiner_evaluation`のDataFrameから抜き出す df= |examiner_id| evaluation | unit | | ---|---|---| |N0......| A |3000| ~~##### for ループで回すなら.~~ ##### DataFrameにめそっどがあるかも - examiner_id列に一致する行インデックスを返すメソッド --> queryメソッドが使えそうでした。TODO下部にメモを記します。 ##### 換算時給の計算アルゴリズム 1. 添削者ごとに、1hごとの工数を出力するコマンドに, `-e`オプションを付けたら換算時給を出す `python analysis.py processed_web_macro_log.csv -g examiner_id -v "man_hour/(cor rection_time/3600)" -e (examiner_evaluation file path)` ``` # ret_dict = {examiner_id: 工数/h, ...} for key in ret_dict.keys(): if (keyがexaminer_evaluationのexaminer_idと一致したら): ret_dict[key] *= (単価) ``` 2. 複雑な場合,例えば(試験種id×添削者id)で換算時給を出す場合 -> 再帰処理を利用 - fujii/macro_analysisブランチからanalysis.pyをコピーする `git pull` `git checkout fujii/macro_analysis -- analysis.py` ## TODO - 関数2つ(換算時給計算、~~添削者評価ファイル(dataframe)から単価を抽出作成~~ → dictに変換すればこの関数は不要では? - コードレビュー(出来れば) --- (3/12追記) ### 設計思想 - "添削者評価ファイル"に捉われない - 本質は、structuralize関数で生成した辞書(ret_dictという変数名にしたやつ)に、追加の計算(四則演算任意指定可)をほどこす事 - "**追加の計算をほどこす**"こと(大事なことなので二回) - 追加計算のもとになるファイル名、keywordの列名、値の列名を指定してもらい、追加計算をほどこす(**ファイルに2列しかない場合は指定なし**でいこう) - よって、**以後は「添削者評価ファイル」→「追加ファイル」と言い換える** ### 実現するための方法2つ 1. (method-1) 現在のstructuralize関数で生成した辞書に対し、後から計算をほどこす(**前回のmtgで話した内容はこちらです**) 2. (method-2) macro preprocessed dataから読み込んだdataframeと、追加ファイルから読み込んだデータを結合する(結合することで、`-v`の後に計算式を書くだけでよくなるので、より抽象的で良いです) --- #### method-1 **手順1,2のコーディングをお願いします!!** 0. stracturalize関数(返り値`ret_dict`)の**後**にコーディング 1. `--add (added file path) [(keyword column name) (value column name)] []内は任意`で与えられた引数1つないし3つを利用してデータを読み取る ``` df_added = pd.read_csv(cmd_args.additional_calculation[0]) if cmd_args.additional_calculation is None: dict_added = dict(df_added.values) else: keyword_colname = cmd_args.additional_calculation[1] value_colname = cmd_args.additional_calculation[2] dict_added = dict(df_added[[(keyword column name), (value column name)]].values) ``` 2. 計算用関数を作る - 入力:ret_dic, dict_added, value=0 - 出力:dict ``` def additional_calculation(dic, dict_added, value=0) -> dict: for key in ret_dict.keys(): if key in dict_added: value = dict_added[key] if type(dic[key]) == dict: additional_calculation(dic[key], dict_added, value=value) else: dic[key] *= value # 四則演算子をハードコーディングするのがmethod-1の弱点 return dic ``` 前回画面共有しながら適当に書いたやつとほぼ同じです。 - `if key in dict_added`が一生trueにならなかったら? - `else`でdic[key]がstringとか文字列だったら? など想定出来る例外がいくつかあると思うので、いくつか動作テストまでお願いします。プログラムの使い方は別途ドキュメントにまとめるので、必ずしも全てのエラーをキャッチする必要はありません。 以上 --- #### method-2 **こんな感じのアルゴリズムも思いつきました。** **こちらの場合も手順1,2のみ。stracturalize関数を呼ぶ前に処理することに注意です** 0. stracturalize関数を**呼ぶ前**に処理しちゃいます 1. method-1の手順1.と同じことをする(dict_added) 2. macro preprocessed data(以降data)のdataframeと統合 - 以下の手順でdataに追加 ``` ds = [] keyword = (df_addedの1列目の列名) or (cmd_args.additional_calculation[1]) for key in data[keyword]: # ここがmethod-2の弱み. dataとdf_addedが全く同じkeywordを持っていないとだめ. ds.append(dict_added[key]) data["added"] = pd.Series(ds) # addedって名前の列名で固定してるの、ほんとは嫌です ``` 以上 ざっくり考えたので、動くかどうか分かりません。 特にmethod-2は抽象化を考えてさっき思いついたので、よく分からないと思います。ので、まずはmethod-1から取り掛かってください!method-1で多分十分です。 ---

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully