Questions tagged [generalization]
131 questions
1
vote
0 answers
R : choosing from 1 to 15 countries and accumulate the value if it is same or over
I'd like to make codes to choose countries according to the number of 1 to 15 and accumulate the value if it is same or over.
Here is what I'm doing for the cases of three countries. But I'd like to make more general one, which doesn't have to make…

jung K
- 11
- 5
1
vote
0 answers
Biased CNN model
I am training a CNN model to classify binary data. It seem to be strongly biased towards one class when an unseen data pattern (Data pattern which it has never seen before during training) is passed. It would make sense if it gives a neutral…

AKSHAYAA VAIDYANATHAN
- 2,715
- 7
- 30
- 51
1
vote
2 answers
A generalized java input output design pattern
I was wondering whether it is possible to generalize the input and output part of a Java program via specific design pattern? I am looking for a way to use a pattern to add different types of implementation in the future. For example, let's say I…

Ali
- 1,759
- 2
- 32
- 69
1
vote
1 answer
Generalization in structs - golang
I have this function to read a JSON file into a Driver struct:
func getDrivers() []Driver {
raw, err := ioutil.ReadFile("/home/ubuntu/drivers.json")
if err != nil {
fmt.Println(err.Error())
os.Exit(1)
}
var d…

kambi
- 3,291
- 10
- 37
- 58
1
vote
2 answers
Numpy Project Euler 1 Generalized Optimization
I've started to learn Numpy and I'm looking for some ways to write this. I've written a generalization of Euler 1. It takes a list of divisors and a number, for example [3, 5] and 1000 in Euler 1.
Naively in pure python:
def subn1(divisors, n):
…

Frej Dahlin
- 11
- 2
1
vote
0 answers
How to make a record assignment parametric in Haskell?
Suppose we have a datatype like this:
data NodeProperties =
NodeProperties
{
p1 :: PropertyInfo Bool,
p2 :: PropertyInfo [String],
p3 :: PropertyInfo [String],
p4 :: PropertyInfo Bool,
p5 ::…

Salvador Tamarit
- 151
- 8
1
vote
0 answers
Matlab: Generalizing a regressor vector
I´m trying to generalize a regressor vector in my NARX-model function.
The regressor vector looks like this:
[-y(i-1) -w(i)*y(i-1) u(i-1) w(i)*u(i-1) u(i-2) w(i)*u(i-2)]
I want to be able to tell my function how many y- and u-values it should…

Toverland
- 15
- 1
- 6
1
vote
2 answers
Encapsulation and generalization function def mult_tasks(str_numbers) in python
The Question:
Without altering mult_tasks, write a definition for mult_tasks_line so that the
doctests pass.
So:
print mult_tasks("3469") will produce:
(3*3) (3*4) (3*6) (3*9)
(4*3) (4*4) (4*6) (4*9)
(6*3) (6*4) (6*6) (6*9)
(9*3) (9*4) (9*6)…

Darsolation
- 35
- 6
1
vote
2 answers
How to avoid repetitive code in QML?
I'm using Qt 5.4.1.
I'm currently setting up some buttons in QML. I want similar state behaviours for some of the buttons - how to do I avoid having large chunks of very similar code repeated through the QML?
Rectangle {
id:…

HorusKol
- 8,375
- 10
- 51
- 92
1
vote
2 answers
From a Generic Tree To a Domain Specific Tree
I want to use a domain specific tree DomainTree consisting of Domain specific Nodes DomainNode, but keep all generic functions in template classes Tree and Node. First I started with the templates Tree and Node (where T is the type of a nodes…

Jochen
- 13
- 4
1
vote
2 answers
Sigma Notation with Index
I've been trying to solve a problem that requires Sigma Notation (Or at least I think), but every implementation of Sigma Notation in Haskell i've come across doesn't use the index variable in its function. The particular formula i've been trying to…

Haskelier
- 83
- 7
1
vote
2 answers
EER - Restrict especializations
Let's say that a "person" can be a "client" OR a "supplier". Using EER we could have something like this:
The problem with this solution is that a person can be BOTH a client and a supplier. Is there a way to restrict a "person" for just one…

Caio
- 3,178
- 6
- 37
- 52
1
vote
2 answers
Generalization of set of facts in CLIPS (trying to find matching slot values in multislot slots)
I am trying to do something like 'facts generalization' in CLIPS (not sure which term describes it best of all) and I am not sure how to do this in a best way.
Consider such situation. I have a set of facts which are described by the below…

Maksim Khaitovich
- 4,742
- 7
- 39
- 70
1
vote
1 answer
How to document Generalization Use Cases
I have a Generalization in my use case diagram. How can I write the specification for each of them.

user3429780
- 11
- 1
1
vote
2 answers
Generalise Bresenham algorithm height octant
I'm trying to implement Bresenham algorithms to have something like :
So in my main, I tested a lot of algorithm something like :
line(ushort x0, ushort y0, ushort x1, ushort y1, const Color couleur)
int dx = abs(x1-x0);
int dy = abs(y1-y0);
int…

Pépito
- 57
- 4
- 11