Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature inversion task (#81) に関わるPR内のテストコードの作成 #85

Merged
merged 27 commits into from
Apr 4, 2024

Conversation

myaokai
Copy link
Contributor

@myaokai myaokai commented Jan 23, 2024

latent / task (core/inversion) / domain / datasetのテストケースの実装
encoder / generatorについてdomainまわりのパターンのテストを追加

  • latent

  • task core

  • task inversion

  • domain core

  • domain image_domain

  • domain feature_domain

  • dataset (相談の上ひとまずなし)

  • encoder

  • generator

@myaokai myaokai changed the base branch from main to feature-inversion-pipeline January 23, 2024 07:40
@myaokai myaokai changed the title Feature inversion task (#81) に関わるPR内のテストコードの作成 [WIP] Feature inversion task (#81) に関わるPR内のテストコードの作成 Jan 23, 2024
Copy link

github-actions bot commented Jan 23, 2024

Coverage

Coverage Report
FileStmtsMissCoverMissing
bdpy/bdata
   bdata.py39922444%79, 104, 109, 113, 118, 122, 132–134, 190, 233–239, 252–262, 276–277, 310, 314, 318–356, 405–411, 414–436, 443–450, 468–469, 475, 508, 539, 548, 560, 589–598, 606–614, 625, 648, 660–664, 671–676, 683–691, 696–729, 738, 750–757, 761–767, 771–799, 803–824, 828–862, 866–868, 872–874, 878–887
   featureselector.py641281%62–67, 69–74
   metadata.py67199%84
   utils.py1133965%71, 82, 85–86, 95, 107–108, 127–173, 201, 246, 258, 263
bdpy/dataform
   datastore.py1078521%59–75, 90–93, 97–98, 102–113, 116–119, 122–127, 131–132, 137–158, 190–197, 222–259, 262–265
   features.py29816545%31–32, 43–46, 90–92, 101–103, 107, 111, 115, 119, 152–153, 157–161, 168–197, 214–215, 224–225, 232–236, 274, 288, 305–319, 323, 327, 331, 335, 339, 343, 347, 351, 355, 359, 364–394, 398–418, 422–462, 465, 470–477, 491–493, 496–499, 502–505, 508–512, 515–516, 536–549
   pd.py9544%25–27, 43–44
   sparse.py67790%29, 52–58, 74, 109, 123
   utils.py12120%3–18
bdpy/dataset
   utils.py45450%3–98
bdpy/distcomp
   distcomp.py921880%33, 35, 49, 53, 55, 66–70, 74, 76, 81–82, 89–93, 97
bdpy/dl
   caffe.py60600%4–129
bdpy/dl/torch
   base.py432444%31–41, 48, 54, 60, 63, 73–83, 90, 96, 102, 105
   dataset.py74740%1–195
   models.py33422632%149–170, 298–317, 328–332, 346–351, 443–495, 516–518, 529–588, 612–615, 626–685, 709–712, 723–772, 791–794, 805–854, 873–876
   torch.py1125551%175–212, 215, 218–230, 233–268
bdpy/dl/torch/domain
   core.py461861%47, 63, 89–90, 99, 102, 137–138, 141–143, 146–148, 164–165, 168, 173
   feature_domain.py24240%1–44
   image_domain.py643742%26, 31, 36, 41, 84–108, 111, 114, 121, 124, 137, 140–150, 179, 211–216, 223, 229
bdpy/evals
   metrics.py956729%49–53, 59–61, 82–112, 118–159, 172–179
bdpy/feature
   feature.py30293%69–70
bdpy/fig
   __init__.py440%6–9
   draw_group_image_set.py90900%3–182
   fig.py88880%16–164
   makeplots.py3363360%1–729
   tile_images.py59590%1–193
bdpy/ml
   crossvalidation.py592754%47–48, 113–114, 117–118, 138, 164–196
   learning.py3089669%43–44, 48, 52, 59, 91–104, 109–125, 128, 158–170, 184–209, 293, 309, 313–315, 318–319, 329, 339–340, 345–346, 356–364, 367–368, 376, 411–418, 439, 452, 460, 469, 501–503, 542, 554, 557, 565, 573, 578, 599
   model.py14012014%29–39, 54–70, 86–144, 156–169, 184–222, 225, 230–250, 254–258, 271–285
   searchlight.py161319%32–51
bdpy/mri
   fmriprep.py4974519%25–34, 38, 44–62, 65–75, 78–89, 92–160, 163–194, 230–360, 367–380, 384, 388–390, 394, 398–400, 410–434, 437–454, 457–464, 471–472, 475–491, 494, 498, 502–815, 819–831, 842–862
   glm.py403610%46–95
   image.py241921%29–54
   load_epi.py281836%36–50, 56–63, 82–88
   load_mri.py191616%16–36
   roi.py2482346%37–100, 122–148, 165–235, 241–314, 320–387, 399–466, 473–499
   spm.py15813912%26–155, 162–166, 170, 174–179, 183–300
bdpy/opendata
   __init__.py110%1
   openneuro.py2102100%1–329
bdpy/pipeline
   config.py36294%37–38
bdpy/preproc
   interface.py521669%111–123, 148–157
   preprocessor.py1296947%35, 44, 112–114, 121–128, 138–189, 196–227
   select_top.py22195%56
bdpy/recon
   utils.py55550%4–146
bdpy/recon/torch
   icnn.py1611610%15–478
bdpy/recon/torch/modules
   critic.py44295%58, 132
   encoder.py29197%29
   generator.py72593%47, 52, 68, 128, 309
   latent.py341362%16, 21, 32, 42, 49, 52, 55, 80–83, 87, 97
bdpy/recon/torch/task
   __init__.py110%1
   inversion.py82820%1–220
bdpy/stats
   corr.py43393%57, 68, 102
bdpy/task
   callback.py71494%114, 161, 166, 234
   core.py14379%41, 46, 56
bdpy/util
   info.py473623%19–79
   utils.py36878%60, 116–121, 140–142
TOTAL5492361934% 

Tests Skipped Failures Errors Time
151 0 💤 18 ❌ 0 🔥 16.443s ⏱️

Copy link
Contributor

@ganow ganow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

いくつかマイナーコメントをいれました

tests/recon/torch/modules/test_latent.py Outdated Show resolved Hide resolved
tests/recon/torch/modules/test_latent.py Outdated Show resolved Hide resolved
tests/recon/torch/modules/test_latent.py Outdated Show resolved Hide resolved
@myaokai myaokai changed the title [WIP] Feature inversion task (#81) に関わるPR内のテストコードの作成 Feature inversion task (#81) に関わるPR内のテストコードの作成 Feb 15, 2024
tests/dl/torch/domain/test_core.py Outdated Show resolved Hide resolved
tests/dl/torch/domain/test_core.py Show resolved Hide resolved
def receive(self, value):
return value.lower()

class TestDomain(unittest.TestCase):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for the implementations of the test cases for the domain module. I think basically the current implementations already cover the minimum test cases. But I would apppreciate it if you could add test cases which check the invertibility of the function domain.send . domain.receive over several example inputs including edge cases. I anticipate the tests like following:

domain = ...  # instantiate some subclass of the reversible domain class
input_candidates = [...]  # candidate of possible inputs including typical & edge-case examples
for x in input_candidates:
    assert x == domain.send(domain.receive(x))
    assert x == domain.receive(domain.send(x))

tests/dl/torch/domain/test_image_domain.py Outdated Show resolved Hide resolved
tests/dl/torch/domain/test_image_domain.py Outdated Show resolved Hide resolved
tests/dl/torch/domain/test_core.py Outdated Show resolved Hide resolved
tests/recon/torch/modules/test_latent.py Outdated Show resolved Hide resolved
tests/recon/torch/modules/test_latent.py Outdated Show resolved Hide resolved
tests/recon/torch/task/test_inversion.py Outdated Show resolved Hide resolved
self.assertTrue(len(self.inversion_task._callback_handler._callbacks) > 0)

# test for process
self.assertEqual(generated_image.shape, (1, 7 * 7 * 3))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps we should first test the type of the return value generated_image otherwise we cannot guarantee it has the instance variable like shape

@ShuntaroAoki ShuntaroAoki merged commit ff116ef into feature-inversion-pipeline Apr 4, 2024
@ShuntaroAoki ShuntaroAoki deleted the myaokai/feat_inv_test branch April 4, 2024 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants