Commit f65eb6d9 authored by Baptiste Bauvin's avatar Baptiste Bauvin
Browse files

Nex files"

"
parent 39c9abe0
Pipeline #4857 failed with stages
in 1 minute and 39 seconds
WIP Multiview Generator
========================
This package aims at generating mutliview datasets according to multipe paramterers :
an error matrix, that tracks the error of each view on each class, a redundancy float that controls the ration of examples that are well described by all the viewsw,
similarly the lutual error float controls the one that are misdescribed in eavery views.
Structure
---------
The class of intereset is located in ``generator/multiple_sub_problems.py`` and called ``MultiViewSubProblemsGenerator``.
A demo is available in ``demo/demo.py`` and generates a 3D dataset, along with a figure that analyzes it.
\ No newline at end of file
multiview_generator:0.0.dev0
\ No newline at end of file
# -*- coding: utf-8 -*-
from __future__ import print_function, division
import time
import os
import sys
import fileinput
def findFiles(directory, files=[]):
"""scan a directory for py, pyx, pxd extension files."""
for filename in os.listdir(directory):
path = os.path.join(directory, filename)
if os.path.isfile(path) and (path.endswith(".py") or
path.endswith(".pyx") or
path.endswith(".pxd")):
if filename != "__init__.py" and filename != "version.py":
files.append(path)
elif os.path.isdir(path):
findFiles(path, files)
return files
def fileUnStamping(filename):
""" Remove stamp from a file """
is_stamp = False
for line in fileinput.input(filename, inplace=1):
if line.find("# COPYRIGHT #") != -1:
is_stamp = not is_stamp
elif not is_stamp:
print(line, end="")
def fileStamping(filename, stamp):
""" Write a stamp on a file
WARNING : The stamping must be done on an default utf8 machine !
"""
old_stamp = False # If a copyright already exist over write it.
for line in fileinput.input(filename, inplace=1):
if line.find("# COPYRIGHT #") != -1:
old_stamp = not old_stamp
elif line.startswith("# -*- coding: utf-8 -*-"):
print(line, end="")
print(stamp)
elif not old_stamp:
print(line, end="")
def getStamp(date, multiview_generator_version):
""" Return the corrected formated stamp """
stamp = open("copyrightstamp.txt").read()
stamp = stamp.replace("DATE", date)
stamp = stamp.replace("MULTIVIEW_GENERATOR_VERSION", multiview_generator_version)
stamp = stamp.replace('\n', '\n# ')
stamp = "# " + stamp
stamp = stamp.replace("# \n", "#\n")
return stamp.strip()
def getVersionsAndDate():
""" Return (date, multimodal_version..
) """
v_text = open('VERSION').read().strip()
v_text_formted = '{"' + v_text.replace('\n', '","').replace(':', '":"')
v_text_formted += '"}'
v_dict = eval(v_text_formted)
return (time.strftime("%Y"), v_dict['multiview_generator'])
def writeStamp():
""" Write a copyright stamp on all files """
stamp = getStamp(*getVersionsAndDate())
files = findFiles(os.path.join(os.path.dirname(os.path.abspath(__file__)),
"multiview_generator"))
for filename in files:
fileStamping(filename, stamp)
fileStamping("setup.py", stamp)
def eraseStamp():
""" Erase a copyright stamp from all files """
files = findFiles(os.path.join(os.path.dirname(os.path.abspath(__file__)),
"multiview_generator"))
for filename in files:
fileUnStamping(filename)
fileUnStamping("setup.py")
def usage(arg):
print("Usage :")
print("\tpython %s stamping" % arg)
print("\tpython %s unstamping" % arg)
if __name__ == "__main__":
if len(sys.argv) == 1:
usage(sys.argv[0])
elif len(sys.argv) == 2:
if sys.argv[1].startswith("unstamping"):
eraseStamp()
elif sys.argv[1].startswith("stamping"):
writeStamp()
else:
usage(sys.argv[0])
else:
usage(sys.argv[0])
######### COPYRIGHT #########
Copyright(c) DATE
-----------------
* Université d'Aix Marseille (AMU) -
* Centre National de la Recherche Scientifique (CNRS) -
* Université de Toulon (UTLN).
* Copyright © 2019-2020 AMU, CNRS, UTLN
Contributors:
------------
* Sokol Koço <sokol.koco_AT_lis-lab.fr>
* Cécile Capponi <cecile.capponi_AT_univ-amu.fr>
* Dominique Benielli <dominique.benielli_AT_univ-amu.fr>
* Baptiste Bauvin <baptiste.bauvin_AT_univ-amu.fr>
Description:
-----------
Version:
-------
* multiview_generator version = MULTIMODAL_VERSION
Licence:
-------
License: New BSD License
######### COPYRIGHT #########
New BSD License
Copyright (c) 2020-15-01, The scikit-multimodallearn developers.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
a. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
b. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
c. Neither the name of the IntertwiningWavelet developers nor the names of
its contributors may be used to endorse or promote products
derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment