Пример #1
0
pls100_device::pls100_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
	: pla_device(mconfig, PLS100, tag, owner, clock)
{
	set_num_inputs(16);
	set_num_outputs(8);
	set_num_terms(48);
}
Пример #2
0
mos8721_device::mos8721_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
	: pla_device(mconfig, MOS8721, tag, owner, clock)
{
	// TODO: actual number of terms is unknown
	set_num_inputs(27);
	set_num_outputs(18);
	set_num_terms(379);
}
Пример #3
0
t_CKBOOL miniAudicle::set_adc( t_CKUINT adc )
{
#ifndef __CHIP_MODE__
    // sanity check
    if( adc > interfaces.size() )
        return FALSE;
    else
        vm_options.adc = adc;

    // set parameters to a reasonable value, if necessary
    set_num_inputs( get_num_inputs() );
#endif // __CHIP_MODE__
    
    return TRUE;
}
Пример #4
0
    void ann::add(int argc, const t_atom *argv)
    {
        if (get_data_type() != data_type::LABELLED_CLASSIFICATION)
        {
            ml::add(argc, argv);
            return;
        }
        
        // work around a bug in GRT where class labels must be contigious
        if (argc < 2)
        {
            flext::error("invalid input length, must contain at least 2 values");
            return;
        }
        
        GRT::UINT numInputDimensions = classification_data.getNumDimensions();
        GRT::UINT numOutputDimensions = 1;
        GRT::UINT combinedVectorSize = numInputDimensions + numOutputDimensions;
        
        if ((unsigned)argc != combinedVectorSize)
        {
            numInputDimensions = argc - numOutputDimensions;
            
            if (numInputDimensions < 1)
            {
                flext::error(std::string("invalid input length, expected at least " + std::to_string(numOutputDimensions + 1)).c_str());
                return;
            }
            post("new input vector size, adjusting num_inputs to " + std::to_string(numInputDimensions));
            set_num_inputs(numInputDimensions);
        }
        
        GRT::VectorDouble inputVector(numInputDimensions);
        GRT::VectorDouble targetVector(numOutputDimensions);
        
        for (uint32_t index = 0; index < (unsigned)argc; ++index)
        {
            float value = GetAFloat(argv[index]);
            
            if (index < numOutputDimensions)
            {
                targetVector[index] = value;
            }
            else
            {
                inputVector[index - numOutputDimensions] = value;
            }
        }
        
        GRT::UINT label = get_index_for_class((GRT::UINT)targetVector[0]);
        
        assert(label > 0);
        
//        if ((double)label != targetVector[0])
//        {
//            flext::error("class label must be a positive integer");
//            return;
//        }
//
//        if (label == 0)
//        {
//            flext::error("class label must be non-zero");
//            return;
//        }
        
        classification_data.addSample(label, inputVector);
    }