Git Product home page Git Product logo

accel-brain / accel-brain-code Goto Github PK

View Code? Open in Web Editor NEW
306.0 20.0 93.0 100.63 MB

The purpose of this repository is to make prototypes as case study in the context of proof of concept(PoC) and research and development(R&D) that I have written in my website. The main research topics are Auto-Encoders in relation to the representation learning, the statistical machine learning for energy-based models, adversarial generation networks(GANs), Deep Reinforcement Learning such as Deep Q-Networks, semi-supervised learning, and neural network language model for natural language processing.

Home Page: https://accel-brain.co.jp

License: GNU General Public License v2.0

JavaScript 0.20% CSS 0.01% HTML 0.02% Python 97.81% Cython 1.95% Makefile 0.01%
automatic-summarization deep-learning deep-reinforcement-learning reinforcement-learning q-learning restricted-boltzmann-machine simulated-annealing quantum-monte-carlo quantum-annealing auto-encoder

accel-brain-code's People

Contributors

accel-brain avatar chimera0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

accel-brain-code's Issues

TypeError: collect_params() takes 1 positional argument but 2 were given

When setting up GANImageGenerator (using tutorial on PyPI) I get following error:

Python\Python37\lib\site-packages\accelbrainbase\observabledata\_mxnet\convolutional_neural_networks.py", line 211, in collect_params
    params_dict = super().collect_params(select)
TypeError: collect_params() takes 1 positional argument but 2 were given

Here's my code:

from pygan.gan_image_generator import GANImageGenerator
from logging import getLogger, StreamHandler, NullHandler, DEBUG, ERROR

logger = getLogger("accelbrainbase")
handler = StreamHandler()
handler.setLevel(DEBUG)
logger.setLevel(DEBUG)
logger.addHandler(handler)

gan_image_generator = GANImageGenerator(
    # `list` of path to your directories.
    dir_list=[
        "Source", 
    ],
    # `int` of image width.
    width=1024,
    # `int` of image height.
    height=1024,
    # `int` of image channel.
    channel=1,
    # `int` of batch size.
    batch_size=40,
    # `float` of learning rate.
    learning_rate=1e-06,
)

I'm using python 3.7

Having implementation issues

I am not sure if the model is working properly. Do you know what the excepted Frechet Inception Distance should be?

controlling output

Hi Team,

one i get the output from pysummarization algorithm. can i exclude few sentences based on the keyword.

thanks in advance.

ValueError: operands could not be broadcast together with shapes

While trying to run pycomposer on MacOS 10.14 Mojave, Python3.7...

After entering this line:

gan_composer.learn(iter_n=1000, k_step=10)
(Note I gave it a midi file of one song, I'm not sure if that was the problem.)
I got this error:

----------------------------------------------------------------------------------------------------
Iterations: (1/10)
----------------------------------------------------------------------------------------------------
The `discriminator`'s turn.
----------------------------------------------------------------------------------------------------
Error raised in Deconvolution layer 1
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-15-0dd5c74c0d95> in <module>
----> 1 gan_composer.learn(iter_n=10, k_step=10)

/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pycomposer/gancomposable/conditional_gan_composer.py in learn(self, iter_n, k_step)
    333             self.__discriminative_model,
    334             iter_n=iter_n,
--> 335             k_step=k_step
    336         )
    337         self.__generative_model = generative_model

/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pygan/generative_adversarial_networks.py in train(self, true_sampler, generative_model, discriminative_model, iter_n, k_step)
     87                     generative_model,
     88                     discriminative_model,
---> 89                     d_logs_list
     90                 )
     91 

/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pygan/generative_adversarial_networks.py in train_discriminator(self, k_step, true_sampler, generative_model, discriminative_model, d_logs_list)
    136         for k in range(k_step):
    137             true_arr = true_sampler.draw()
--> 138             generated_arr = generative_model.draw()
    139             true_posterior_arr = discriminative_model.inference(true_arr)
    140             generated_posterior_arr = discriminative_model.inference(generated_arr)

/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pygan/generativemodel/conditionalgenerativemodel/conditional_convolutional_model.py in draw(self)
    174             conv_arr += noise_arr
    175 
--> 176         deconv_arr = self.__deconvolution_model.inference(conv_arr)
    177         return np.concatenate((observed_arr, deconv_arr), axis=self.conditional_axis)
    178 

/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pygan/generativemodel/deconvolution_model.py in inference(self, observed_arr)
    110         for i in range(len(self.__deconvolution_layer_list)):
    111             try:
--> 112                 observed_arr = self.__deconvolution_layer_list[i].forward_propagate(observed_arr)
    113             except:
    114                 self.__logger.debug("Error raised in Deconvolution layer " + str(i + 1))

pydbm/cnn/layerablecnn/convolutionlayer/deconvolution_layer.pyx in pydbm.cnn.layerablecnn.convolutionlayer.deconvolution_layer.DeconvolutionLayer.forward_propagate()

pydbm/activation/softmax_function.pyx in pydbm.activation.softmax_function.SoftmaxFunction.activate()

pydbm/activation/softmax_function.pyx in pydbm.activation.softmax_function.SoftmaxFunction.forward()

ValueError: operands could not be broadcast together with shapes (20,1,8,1259) (201440,1) 

about bar_gram.py function extract_features

def extract_features(self, df):
    pitch_tuple = tuple(df.pitch.values.tolist())
    arr = np.zeros(self.__dim)
    try:
        arr[self.pitch_tuple_list.index(pitch_tuple)] = 1
    except ValueError:
        pitch_key = np.random.randint(low=0, high=len(pitch_tuple))
        arr[pitch_tuple[pitch_key]] = 1

    arr = arr.astype(float)
    return arr

If this exception is thrown, this line 'arr[pitch_tuple[pitch_key]] = 1' very likely go wrong, 'pitch_tuple[pitch_key] ' usually some big number. or you mean :

    except ValueError:
        pitch_key = np.random.randint(low=0, high=len(self.pitch_tuple_list))
        arr[pitch_key] = 1

Output File Size

Can I get any control over the output filesize? The quality is great

pip install fails

pip install accelbrainbase

ERROR: Could not find a version that satisfies the requirement accelbrainbase (from versions: none)
ERROR: No matching distribution found for accelbrainbase

trying to import and getting error. My numpy version1.26.4

from pygan._mxnet.gan_image_generator import GANImageGenerator

AttributeError Traceback (most recent call last)
Cell In[53], line 2
1 # Import necessary modules from pygan library
----> 2 from pygan._mxnet.gan_image_generator import GANImageGenerator
4 # Set up logger (optional)
5 from logging import getLogger, StreamHandler, DEBUG

File c:\Users\anush\OneDrive\Desktop\defence framework\pythonProjectDefence\lib\site-packages\pygan_mxnet\gan_image_generator.py:2
1 # -- coding: utf-8 --
----> 2 from accelbrainbase.computableloss._mxnet.l2_norm_loss import L2NormLoss
3 from accelbrainbase.extractabledata._mxnet.image_extractor import ImageExtractor
4 from accelbrainbase.iteratabledata._mxnet.unlabeled_image_iterator import UnlabeledImageIterator

File c:\Users\anush\OneDrive\Desktop\defence framework\pythonProjectDefence\lib\site-packages\accelbrainbase\computableloss_mxnet\l2_norm_loss.py:3
1 # -- coding: utf-8 --
2 from accelbrainbase.computable_loss import ComputableLoss
----> 3 from mxnet.gluon.loss import Loss
4 from mxnet.gluon.loss import _reshape_like, _apply_weighting
7 class L2NormLoss(Loss, ComputableLoss):

File c:\Users\anush\OneDrive\Desktop\defence framework\pythonProjectDefence\lib\site-packages\mxnet_init_.py:33
30 # version info
31 version = base.version
---> 33 from . import contrib
...
---> 27 from .utils import * # pylint: disable=wildcard-import
28 from .function_base import * # pylint: disable=wildcard-import
29 from .stride_tricks import * # pylint: disable=wildcard-import

AttributeError: module 'mxnet.numpy.utils' has no attribute 'bool'

No module named 'pycomposer.conditional_gan_composer'

from pycomposer.conditional_gan_composer import ConditionalGANComposer

`---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
in
----> 1 from pycomposer.conditional_gan_composer import ConditionalGANComposer

ModuleNotFoundError: No module named 'pycomposer.conditional_gan_composer'`

No module named 'MeCab'

Hi, thank you for the great library!

It looks like I've found some issue, here is my example of code:


from pysummarization.nlp_base import NlpBase
from pysummarization.nlpbase.auto_abstractor import AutoAbstractor
from pysummarization.tokenizabledoc.mecab_tokenizer import MeCabTokenizer
from pysummarization.abstractabledoc.top_n_rank_abstractor import TopNRankAbstractor
from pysummarization.similarityfilter.tfidf_cosine import TfIdfCosine


document = """
my long text here
"""

# The object of the NLP.
nlp_base = NlpBase()
# Set tokenizer. This is japanese tokenizer with MeCab.
nlp_base.tokenizable_doc = MeCabTokenizer()

# The object of `Similarity Filter`.
# The similarity observed by this object is so-called cosine similarity of Tf-Idf vectors.
similarity_filter = TfIdfCosine()

# Set the object of NLP.
similarity_filter.nlp_base = nlp_base

# If the similarity exceeds this value, the sentence will be cut off.
similarity_filter.similarity_limit = 0.25

# The object of automatic sumamrization.
auto_abstractor = AutoAbstractor()
# Set tokenizer. This is japanese tokenizer with MeCab.
auto_abstractor.tokenizable_doc = MeCabTokenizer()
# Object of abstracting and filtering document.
abstractable_doc = TopNRankAbstractor()
# Delegate the objects and execute summarization.
result_dict = auto_abstractor.summarize(document, abstractable_doc, similarity_filter)


# Output result.
for i, sentence in enumerate(result_dict["summarize_result"]):
    print(sentence, result_dict["scoring_data"][i])

And result of its execution with Python 3.7.4:

python3 summarizer.py 
Traceback (most recent call last):
  File "summarizer.py", line 3, in <module>
    from pysummarization.tokenizabledoc.mecab_tokenizer import MeCabTokenizer
  File "/usr/local/lib/python3.7/site-packages/pysummarization/tokenizabledoc/mecab_tokenizer.py", line 3, in <module>
    import MeCab
ModuleNotFoundError: No module named 'MeCab'

pygan true_sampler

I tried to create a true sampler object from the existing numerical datasets via ConditionalTrueSampler but the error message said Can't instantiate abstract class ConditionalTrueSampler with abstract methods add_condition, draw. How can I create the true sample using my own data?

Gan_composer error

I was trying to work this out, and an error raised when the function gan_composer.learn is called, as if it wasn't recognised. I think i made sura that everything that needs to be installed or run is working, but it still doesn't work. If anyone could give me some help :)

image

recommendation system

I have seen this library very nice and attracted to me for the reinforcement learning. My question is that is this helpful in making recommendation system in terms of reinforcement learning? while performing any task or any workflow / xml based or any manual based?

Please guide

ValueError: shapes (40,7360) and (15200,1) not aligned: 7360 (dim 1) != 15200 (dim 0)

I run demo got this error, how do I set the parameters of this function 'ConditionalGANComposer()'

midi_path_list=[
"D:\\test\\Automatic Composition\\test.mid"

],
# Batch size.
batch_size=40,
# The length of sequence that LSTM networks will observe.
seq_len=8,
# Learning rate in `Generator` and `Discriminator`.
learning_rate=1e-10,
# Time fraction or time resolution (seconds).
time_fraction=0.5,
)
Iterations: (1/1000)
----------------------------------------------------------------------------------------------------
The 'discriminator''s turn.
----------------------------------------------------------------------------------------------------
Traceback (most recent call last):
  File "D:/Git clone/audio-tech/projects/projects_hybrid/CloudMusician/PythonScripts/AnalysisMIDIFile/pycomposer_test.py", line 35, in <module>
    k_step=10
  File "D:\software\Anaconda3\lib\site-packages\pycomposer\gancomposable\conditional_gan_composer.py", line 335, in learn
    k_step=k_step
  File "D:\software\Anaconda3\lib\site-packages\pygan\generative_adversarial_networks.py", line 89, in train
    d_logs_list
  File "D:\software\Anaconda3\lib\site-packages\pygan\generative_adversarial_networks.py", line 139, in train_discriminator
    true_posterior_arr = discriminative_model.inference(true_arr)
  File "D:\software\Anaconda3\lib\site-packages\pygan\discriminativemodel\cnnmodel\seq_cnn_model.py", line 36, in inference
    return super().inference(observed_arr)
  File "D:\software\Anaconda3\lib\site-packages\pygan\discriminativemodel\cnn_model.py", line 141, in inference
    return self.__cnn.inference(observed_arr)
  File "pydbm\cnn\convolutional_neural_network.pyx", line 515, in pydbm.cnn.convolutional_neural_network.ConvolutionalNeuralNetwork.inference
  File "pydbm\cnn\convolutional_neural_network.pyx", line 554, in pydbm.cnn.convolutional_neural_network.ConvolutionalNeuralNetwork.forward_propagation
  File "pydbm\cnn\convolutional_neural_network.pyx", line 571, in pydbm.cnn.convolutional_neural_network.ConvolutionalNeuralNetwork.output_forward_propagate
ValueError: shapes (40,7360) and (15200,1) not aligned: 7360 (dim 1) != 15200 (dim 0)

cycle_len limitation

I'm using pydbm to working on a problem similar to Encoder/Decoder for Anomaly Detection(EncDec-AD). I found the cycle_len's maximum value is 50. Why is that? Is it because the TanhFunction's memory size is 50? I want to use 128 point sequences. Is there any way to change this value? Thanks.

No module name 'pydbm' after pip install

I have installed pydbm using pip, and the Dependencies numpy as well as cython was installed.
image
But there is no module named pydbm error.
image
Here is sys.path
image
It seems that pydbm miss sorce file in python/site-packages.
image

MXNetError: GPU is not enabled

MXNetError: Traceback (most recent call last):
File "C:\Jenkins\workspace\mxnet-tag\mxnet\src\ndarray\ndarray.cc", line 1298
MXNetError: GPU is not enabled

Module not found in pybdm

Hi ! I have problems with pydbm 1.4.4 using search_maze_by_deep_q_network.ipynb. The module pydbm.cnn.convolutional_neural_network isn't found. Indeed I only found a convolutional_neural_network.pyx in pydbm/cnn not the actual module.
Thanks in advance for your help

how to get N number of sentences ?

Hi Team,

am using the pysummarization technique to summarize my document. with this library am able to get the top 10 ranked sentences only. if i need more then 10 ?

And how this 10 sentences this technique is picking also i am not clear on the document.

please help on these two things.

pip install pysummarization does not work

pip installation fails with the error:-

Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/vp/1jfcmynj25d2d_3dpxr3yckr0000gn/T/pip-install-tqd95hyf/mecab-python3/

Save the 'generative_model' to local file and load it to compose

Could you add a method to save the training model of 'gan_composer'? save to json or some format else, so that I can use 'gan_composer.compose()' quickly generate the appropriate MIDI. Or could you teach me how to save the 'generative_model' and load it from local file?

How can i save my Model?

hello I dont Know How Can I save My PyGan Model ..I cant find any code for this on Doc provided please do reply..

OSError: [WinError 126] The specified module could not be found

Cannot run the code, as its not importing the Class

Traceback (most recent call last):
  File "compose.py", line 1, in <module>
    from pycomposer.gancomposable._mxnet.conditional_gan_composer import ConditionalGANComposer
  File "C:\Users\ZAID\miniconda3\envs\py37\lib\site-packages\pycomposer\gancomposable\_mxnet\conditional_gan_composer.py", line 4, in <module>
    import mxnet as mx
  File "C:\Users\ZAID\miniconda3\envs\py37\lib\site-packages\mxnet\__init__.py", line 24, in <module>
    from .context import Context, current_context, cpu, gpu, cpu_pinned
  File "C:\Users\ZAID\miniconda3\envs\py37\lib\site-packages\mxnet\context.py", line 24, in <module>
    from .base import classproperty, with_metaclass, _MXClassPropertyMetaClass
  File "C:\Users\ZAID\miniconda3\envs\py37\lib\site-packages\mxnet\base.py", line 213, in <module>
    _LIB = _load_lib()
  File "C:\Users\ZAID\miniconda3\envs\py37\lib\site-packages\mxnet\base.py", line 204, in _load_lib
    lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_LOCAL)
  File "C:\Users\ZAID\miniconda3\envs\py37\lib\ctypes\__init__.py", line 364, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found

About how to use Q-learning

Hi, I'm a student working on a project that requires using Q-learning. I want to know is there any material about the packet function interfaces? I didn't find some useful info in README file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.