radnn 0.0.8__py3-none-any.whl → 0.0.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
radnn/__init__.py CHANGED
@@ -3,8 +3,9 @@
3
3
  # Version 0.0.6 [2025-02-04]
4
4
  # Version 0.0.7.2 [2025-02-17]
5
5
  # Version 0.0.7.3 [2025-02-21]
6
- # Version 0.0.8 [2025-02-xx]
7
- __version__ = "0.0.8"
6
+ # Version 0.0.8 [2025-02-25]
7
+ # Version 0.0.9 [2025-03-xx]
8
+ __version__ = "0.0.9"
8
9
 
9
10
  from .system import FileStore, FileSystem
10
11
  from .ml_system import MLSystem
@@ -236,7 +236,7 @@ class DataSetBase(object):
236
236
  def has_cache(self, samples_file_prefix="Samples"):
237
237
  return self.filestore.exists("%s.pkl" % samples_file_prefix) or self.filestore.exists("%s.TS.pkl" % samples_file_prefix)
238
238
  # --------------------------------------------------------------------------------------------------------------------
239
- def load_cache(self, filestore: FileStore = None, samples_file_prefix="Samples", targets_file_prefix="Labels", is_verbose=False):
239
+ def load_cache(self, filestore: FileStore = None, samples_file_prefix="Samples", targets_file_prefix="Labels", ids_file_prefix="Ids", is_verbose=False):
240
240
  if filestore is None:
241
241
  filestore = self.filestore
242
242
  if filestore is None:
@@ -258,30 +258,39 @@ class DataSetBase(object):
258
258
 
259
259
  self.samples = filestore.obj.load("%s.pkl" % samples_file_prefix)
260
260
  self.labels = filestore.obj.load("%s.pkl" % targets_file_prefix)
261
-
261
+
262
262
  if is_verbose:
263
263
  print("Loading training set ...")
264
264
  nTSSamples = filestore.obj.load("%s.TS.pkl" % samples_file_prefix)
265
265
  nTSTargets = filestore.obj.load("%s.TS.pkl" % targets_file_prefix)
266
266
  self.assign_training_set(nTSSamples, nTSTargets)
267
-
267
+ nTSIDs = filestore.obj.load("%s.TS.pkl" % ids_file_prefix)
268
+ if nTSIDs is not None:
269
+ self.ts_sample_ids = nTSIDs
270
+
268
271
  if is_verbose:
269
272
  print("Loading validation set ...")
270
273
  nVSSamples = filestore.obj.load("%s.VS.pkl" % samples_file_prefix)
271
274
  nVSTargets = filestore.obj.load("%s.VS.pkl" % targets_file_prefix)
272
275
  self.assign_validation_set(nVSSamples, nVSTargets)
273
-
276
+ nVSIds = filestore.obj.load("%s.VS.pkl" % ids_file_prefix)
277
+ if nVSIds is not None:
278
+ self.vs_sample_ids = nVSIds
279
+
274
280
  if is_verbose:
275
281
  print("Loading unknown test data set ...")
276
282
  nUTSamples = filestore.obj.load("%s.UT.pkl" % samples_file_prefix)
277
283
  if nUTSamples is not None:
278
284
  nUTTargets = filestore.obj.load("%s.UT.pkl" % targets_file_prefix)
279
285
  self.assign_unknown_test_set(nUTSamples, nUTTargets)
286
+ nUTIds = filestore.obj.load("%s.UT.pkl" % ids_file_prefix)
287
+ if nUTIds is not None:
288
+ self.ut_sample_ids = nUTIds
280
289
 
281
290
 
282
291
  return bResult
283
292
  # --------------------------------------------------------------------------------------------------------------------
284
- def save_cache(self, filestore: FileStore = None, samples_file_prefix="Samples", targets_file_prefix="Labels"):
293
+ def save_cache(self, filestore: FileStore = None, samples_file_prefix="Samples", targets_file_prefix="Labels", ids_file_prefix="Ids"):
285
294
  if filestore is None:
286
295
  filestore = self.filestore
287
296
  if filestore is None:
@@ -293,13 +302,16 @@ class DataSetBase(object):
293
302
 
294
303
  filestore.obj.save(self.ts_samples, "%s.TS.pkl" % samples_file_prefix, is_overwriting=True)
295
304
  filestore.obj.save(self.ts_labels, "%s.TS.pkl" % targets_file_prefix, is_overwriting=True)
305
+ filestore.obj.save(self.ts_sample_ids, "%s.TS.pkl" % ids_file_prefix, is_overwriting=True)
296
306
 
297
307
  filestore.obj.save(self.vs_samples, "%s.VS.pkl" % samples_file_prefix, is_overwriting=True)
298
308
  filestore.obj.save(self.vs_labels, "%s.VS.pkl" % targets_file_prefix, is_overwriting=True)
309
+ filestore.obj.save(self.vs_sample_ids, "%s.VS.pkl" % ids_file_prefix, is_overwriting=True)
299
310
 
300
311
  if self.ut_samples is not None:
301
312
  filestore.obj.save(self.ut_samples, "%s.UT.pkl" % samples_file_prefix, is_overwriting=True)
302
313
  filestore.obj.save(self.ut_labels, "%s.UT.pkl" % targets_file_prefix, is_overwriting=True)
314
+ filestore.obj.save(self.ut_sample_ids, "%s.UT.pkl" % ids_file_prefix, is_overwriting=True)
303
315
 
304
316
  self.card["name"] = self.name
305
317
  if self.feature_count is not None:
@@ -32,6 +32,9 @@ import json
32
32
  import glob
33
33
  from .fileobject import FileObject
34
34
 
35
+ #TODO: jsonpickle
36
+ #https://stackoverflow.com/questions/3768895/how-to-make-a-class-json-serializable
37
+
35
38
  class JSONFile(FileObject):
36
39
  # ----------------------------------------------------------------------------------
37
40
  def __init__(self, filename, parent_folder=None, error_template=None):
@@ -43,24 +43,24 @@ class TextFile(FileObject):
43
43
  def load(self, filename=None, encoding=None):
44
44
  filename = self._useFileName(filename)
45
45
 
46
- oEncodingToTry = ["utf-8", "utf-16", "latin1", "ascii"] # Add more if needed
47
-
48
46
  sText = None
49
- if encoding is None:
50
- bIsLoaded = False
51
- for sEnc in oEncodingToTry:
52
- try:
53
- with open(filename, "r", encoding=sEnc) as oFile:
54
- sText = oFile.read()
55
- bIsLoaded = True
56
- break
57
- except (UnicodeDecodeError, UnicodeError):
58
- continue
59
- if not bIsLoaded:
60
- raise ValueError("Unsupported encoding")
61
- else:
62
- with open(filename, "r", encoding=encoding) as oFile:
63
- sText = oFile.read()
47
+ if os.path.isfile(filename):
48
+ oEncodingToTry = ["utf-8", "utf-16", "latin1", "ascii"] # Add more if needed
49
+ if encoding is None:
50
+ bIsLoaded = False
51
+ for sEnc in oEncodingToTry:
52
+ try:
53
+ with open(filename, "r", encoding=sEnc) as oFile:
54
+ sText = oFile.read()
55
+ bIsLoaded = True
56
+ break
57
+ except (UnicodeDecodeError, UnicodeError):
58
+ continue
59
+ if not bIsLoaded:
60
+ raise ValueError("Unsupported encoding")
61
+ else:
62
+ with open(filename, "r", encoding=encoding) as oFile:
63
+ sText = oFile.read()
64
64
 
65
65
  return sText
66
66
  # --------------------------------------------------------------------------------------------------------------------
@@ -74,9 +74,6 @@ class TextFile(FileObject):
74
74
  p_sFileName : Full path to the text file
75
75
  p_sText : Text to write
76
76
  """
77
- if (self.parent_folder is not None):
78
- sFilename = os.path.join(self.parent_folder, sFilename)
79
-
80
77
  if self.is_verbose:
81
78
  print(" {.} Saving text to %s" % sFilename)
82
79
 
@@ -1,35 +1,13 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: radnn
3
- Version: 0.0.8
3
+ Version: 0.0.9
4
4
  Summary: Rapid Deep Neural Networks
5
5
  Author-email: "Pantelis I. Kaplanoglou" <pikaplanoglou@ihu.gr>
6
- License: MIT License
7
-
8
- Copyright (c) 2017-2025 Pantelis I. Kaplanoglou
9
-
10
- Permission is hereby granted, free of charge, to any person obtaining a copy
11
- of this software and associated documentation files (the "Software"), to deal
12
- in the Software without restriction, including without limitation the rights
13
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
- copies of the Software, and to permit persons to whom the Software is
15
- furnished to do so, subject to the following conditions:
16
-
17
- The above copyright notice and this permission notice shall be included in all
18
- copies or substantial portions of the Software.
19
-
20
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
- SOFTWARE.
27
-
6
+ License-Expression: MIT
28
7
  Project-URL: Homepage, https://github.com/pikaplan/radnn
29
8
  Project-URL: Documentation, https://radnn.readthedocs.io/
30
9
  Classifier: Intended Audience :: Science/Research
31
10
  Classifier: Intended Audience :: Developers
32
- Classifier: License :: OSI Approved :: MIT License
33
11
  Classifier: Programming Language :: Python
34
12
  Classifier: Topic :: Software Development
35
13
  Classifier: Topic :: Scientific/Engineering
@@ -47,6 +25,7 @@ Requires-Dist: numpy>=1.26.4
47
25
  Requires-Dist: matplotlib>=3.8.4
48
26
  Requires-Dist: pandas>=2.2.1
49
27
  Requires-Dist: scikit-learn>=1.4.2
28
+ Dynamic: license-file
50
29
 
51
30
  # radnn - Rapid Deep Neural Networks
52
31
 
@@ -1,11 +1,11 @@
1
- radnn/__init__.py,sha256=G0PsHmid1DPmViG5S9h4MZpTlVZuv6QOUifmK8PHhb8,396
1
+ radnn/__init__.py,sha256=uknFzhEVVS5y1sy4AeAc6YGb2t5ZulzG7muKMXwrT-A,429
2
2
  radnn/core.py,sha256=-v25_yJyioyH_juGPJLWvKojwkdy4AF2TuWMPcnqjDA,4565
3
3
  radnn/errors.py,sha256=gFiJYngMO24BApzd1auSBNASeS238MAmG3tubCr0POU,1716
4
4
  radnn/ml_system.py,sha256=ycd9y26br7TvIWE39X6DBJ5jEU8A_6fmwr9F4htK8mI,5927
5
5
  radnn/utils.py,sha256=7WY0c0ZalfE4XJJuolK-KgW4FFEBL4HfiLuaEAJGVt4,7675
6
6
  radnn/data/__init__.py,sha256=IExy6eV9QSr3b2LaI3cND7P4W-kPHivHMleJsKETh00,405
7
7
  radnn/data/data_feed.py,sha256=Hb8eROxZ7OFJ9a4-CM6Dibbx7v46QbkoiSIAjwCfs1Y,7290
8
- radnn/data/dataset_base.py,sha256=VRGlXZhcBb7i5p39GbqUjau12UxPb2kwBVQTZTVG-WI,15184
8
+ radnn/data/dataset_base.py,sha256=fuYFFypHzYnH3CWb1psfXdjTuU_YRCEaJuotUtpEufk,15903
9
9
  radnn/data/dataset_folder.py,sha256=-6dL61ptVpHyMf1hc7B87w6oaLrZYOY6CGJVBkmhqp8,2475
10
10
  radnn/data/image_dataset.py,sha256=2TOKXKml0qzj1CvMfJdMMjE3QhquCD-lZIsttFDuBoM,4516
11
11
  radnn/data/image_dataset_files.py,sha256=9CLIu44MYq6LIU58o-qxqPucnXxRq4rQnAwTAYFuJ3c,7508
@@ -50,9 +50,9 @@ radnn/system/files/csvfile.py,sha256=xoV0tGKDKlIq20P7-9NQ2Pq0rX3XrM-fTgumWN-uHmI
50
50
  radnn/system/files/filelist.py,sha256=HsyBUtDSKmo_aGfezIvmLqtCCbH-y7Ybv03Tb1ZZKO4,2042
51
51
  radnn/system/files/fileobject.py,sha256=nHz0JumwsO_T9BNLbCzkhca6i5ScweYuIenhpaLAovo,4095
52
52
  radnn/system/files/imgfile.py,sha256=B752yCxnHcJDwC7qognZ6zLKnqXcEUUuMrUEglXkXT8,2484
53
- radnn/system/files/jsonfile.py,sha256=bjS1gnM1QMAP7zmCTGWq3-Z86iwdIq20mk58-guKBMQ,3533
53
+ radnn/system/files/jsonfile.py,sha256=BOyVUkpPMS23f6WamcIyEIvX9PeH0os-nydmNpC0s80,3638
54
54
  radnn/system/files/picklefile.py,sha256=n362cyoxwZtANJwuu8xHWDLttqNY4QqwDR1Jh-2VwUk,5768
55
- radnn/system/files/textfile.py,sha256=9wdubEW9tVEwA1-s1n3UtabW7-QTjSdUBIe_rdSyWVA,4001
55
+ radnn/system/files/textfile.py,sha256=si8BgszEFNhW_XKgF7sS_6wgpSdHTEUvtXQgIS88a7M,3958
56
56
  radnn/system/hosts/__init__.py,sha256=k2gkMJhe96Nf-V2ex6jZqmCRX9vA_K6gFB8J8Ii9ahc,261
57
57
  radnn/system/hosts/colab_host.py,sha256=i0s43KjdJ-gjLGyQAItubz2gZvOj-DbFnH1EGYguoVk,4000
58
58
  radnn/system/hosts/linux_host.py,sha256=AuOTpQ3OB1SXvsS1F-ksLVL44HXeRz5UEM2jbQ_1nbg,1623
@@ -63,8 +63,8 @@ radnn/system/threads/thread_context.py,sha256=wbRmeIoJSZaLH6Z_Gra-X2uqYLmMFL7ZLp
63
63
  radnn/system/threads/thread_safe_queue.py,sha256=rtOoflj7lXeYAbISTU36ftYNcv0bgT8c4_Fs4qFfslU,6216
64
64
  radnn/system/threads/thread_safe_string_collection.py,sha256=vdRMvwJ8CcLmsJ1uildoNjJ5OYruWyGRlCr7amtMUeU,2391
65
65
  radnn/system/threads/thread_worker.py,sha256=5KANBBHwnyaMvjyelBT1eyZCzRtH7MNZiHUhN1Xl1BY,3466
66
- radnn-0.0.8.dist-info/LICENSE.txt,sha256=vYtt_GDvm_yW65X9YMBOOu8Vqc9SAvqH94TbfBc2ckU,1106
67
- radnn-0.0.8.dist-info/METADATA,sha256=65_TJ_G3vNVqL2DVVPk6KgmIgtyL3fYGlaKX4zVLVDk,2861
68
- radnn-0.0.8.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
69
- radnn-0.0.8.dist-info/top_level.txt,sha256=FKlLIm6gRAeZlRzs-HCBJAB1q9ELJ7MgaL-qqFuPo6M,6
70
- radnn-0.0.8.dist-info/RECORD,,
66
+ radnn-0.0.9.dist-info/licenses/LICENSE.txt,sha256=vYtt_GDvm_yW65X9YMBOOu8Vqc9SAvqH94TbfBc2ckU,1106
67
+ radnn-0.0.9.dist-info/METADATA,sha256=pRzxFjDAlZv-Aseunl5zCmiSbiL48i7YGVYAAHPJ7uE,1572
68
+ radnn-0.0.9.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
69
+ radnn-0.0.9.dist-info/top_level.txt,sha256=FKlLIm6gRAeZlRzs-HCBJAB1q9ELJ7MgaL-qqFuPo6M,6
70
+ radnn-0.0.9.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.0)
2
+ Generator: setuptools (78.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5