LiquidSoap - random not working as expected - icecast

From my liquidsoap configuration:
radio = random(weights = [1, 4], [jingles,standard])
I interpret this as playing 1 random jingle for every 4 random tracks from the 'standard' playlist.
But I often get 2 jingles playing consecutively. Am I misunderstanding the logic of the configuration? How can I make it just play ONE jingle only for each 4 standard playlist tracks?

You can use this config:
jingles = once(jingles)
Put it before your random point.
Let me know if this helps.

Related

ml.net Predict an outcome using historical data

I am a complete to newbie to machine learning but I am trying to achieve following:
I have a series of data, let's say:
ie:
[ {'day1', 5}, {'day2', 3}, {'day3', 8} ... {'day100', 8}]
that at the end has a final result:
ie: pass/fail/other result
I would like to predict the most likely end result by using a partial set of data
ie: [{'day1', 3}, {'day2', 1}, {'day3', 6} ... {'day50', 8}]
What would be the best way to achieve this and if possible, do you have any examples or hint of where to look into that could help someone like me with no experience in machine learning
It is a time series prediction.
I'd suggest you check if your time series contain trend or seasonality. Then try conventional methods of time-series prediction as moving average (or sliding window) when you, for example, predict day 6 based on days 1-5, then day 7 based on days 2-6 etc. You may also try Exponential Smoothing and ARIMA.
Concerning ml.net, the following tutorial is the best solution for you
as it uses a Singular Spectrum Analysis and thus takes into consideration a trend and possible seasonality to forecast values. You can employ it by using
ssaforecastingestimator: put window = 25 and horizon=1 if you want to use the first 25 days to predict the value for day 26 (prediction one step forward). I suggest you take a smaller window though (5-7 days).

Python - Need to cut user input and run the numbers in a loop

I'm not that great at python just getting snippets from here and there.
Right now I have user input, button click that runs the user's input and that is working for individual single inputs.
I am trying to make a user input with multiple answers
Example "1, 2, 5, 7, 23" -> To infinity amount
When submitted I need those answers to run in a loop until they are all used up.
So 5 answers would run the loop 5 times, each time using a different number from the user input.
By "each time using a different number" I mean I will be running a modbus coil command and those integers will be the coil address. Thus turning on or off those coils via the running loop.
So something like..
usernumbers = self.txtinput.get_text()
usernumbers.split()
usernumbersamount = len(usernumbers.split()
while usernumbers <= useramount:
modbus command goes here
Thats about as far as I can get of it will even work, Maybe it needs to be in an array for it to work?
sorry if user input looks funny this will be ran in a browser
Thanks!!
If the user separates the numbers using always the same character (space for instance) you can write:
usernumbers = self.txtinput.get_text()
for coil_address in [usernumbers.split()]:
self.run_coil_command(coil_address)
Change the split() by providing the separator used in you application: split(','), split(':'), ...

Netlogo - ifelse statement

I have a problem in Netlogo, where i should check if a neighbor patch of a specific patch is already colored black.
This is how i thought it could work:
ifelse [ask patch xcoord-temp ycoord-temp [ask patches in-radius rnd_radius [pcolor = black]]]?
[print "true"]
[print "false"]
Error Message is: Expected a TRUE/FALSE here, rather than a list or block.
xcoord-temp and ycoord-temp are calculated coordinates.
rnd_radius is a random radius between 1 and 15.
So does someone has an idea how to solve this?
Thanks!
Regards,
John
Okay first, the reporter patch receives an identificator that's linked to a patch. If you want to ask something to a patch at a certain position you want to use [patch-at]1.
Second, I don't understand the use of question mark in your code ?.
Third, by using [pcolor = black] the compiler understands you want to set rather than get.
Lastly, you can use the word of to access values of an agent.
So I would put it out like this:
to myprocedure
ask patch-at xcoord-temp ycoord-temp
[
check-color
]
end
to check-color
ifelse [pcolor] of (patches in-radius rnd_radius) = black
[print "true"]
[print "false"]
end
Note than I'm using an extra procedure that may not be complete, perhaps it would have to receive the temporal coordinates you use; unless these coordinates are global variables that change overtime, then you can use the procedures like that.
Please tell us if this helps you, I don't have NetLogo installed right now, I did that based on the dictionary.
Edit:
As stated in the comments
[pcolor] of (patches in-radius rnd_radius) will return a list, thus it can never equal black.
You'll have to ask for an specific neighbor of the patch or perhaps use one-of in the list resulting from the previous statement..
The simplest and least verbose way would be to write a reporter procedure like this
to-report any-black-neighbors-in-radius? [r]
report any? patches in-radius r with [pcolor = black]
end
You can then ask a patch to run this procedure using r as a parameter, and either print the value, or use it for something else. Like this:
ask one-of patches [print any-black-neighbors-in-radius 5]
If you want to ask a particular patch to run it, just ask that patch using patch, like so:
ask patch 5 -5 [print any-black-neighbors-in-radius 3]

Not getting expected results from complex view

This is a somewhat involved question as the data I am working with is a little large.
I have the following document structure: https://gist.github.com/gaigepr/5b28a7c67ced0cd71e4e
and the following map function: https://gist.github.com/gaigepr/a721bcc8ef6f681f3807
A little description, this function goes through the example document to collect a list of all combinations of characters from 1 to 5 and supplies them with a 1 or 0 to indicate a win or a loss for that particular combo of characters. This is accomplished by getting the powerset of the team and ignoring the empty set when emitting the array key and integer to indicate a win or loss.
The problem I am having is with reducing the data. My goal is to get the win rate of a particular group of characters in the game this data is from. the view takes a key formatted as such: [1] and should output the win rate and games played by that pair of characters.
so my reduce function should be something like this:
However when I do this, I do not actually get all the games played by that pair in the reduction. in my test database, I have 96 games played by the above pair [1, 18] but when I run map and reduce on the with that key, I get that there were only 2 games played and null for the win rate.
A note: This seems to only happen inconsistently. With my data, when I query with the key [1, 18] I get accurate results.
I am a little bit at a loss for what to do to debug this and would appreciate some help. I am happy to add more details, gists, even pictures of the futon output if that would be helpful.
I do not have a lot of reason for this yet, or confirmation, but it seems that the data passed to the reduce function is not formatted how I expect it to be but I am not sure why that is.

Neo4j search unknown number of properties

I've got graph like that:
(A)-[r1]-(B)-[r2]-(C)
The thing is, that r1 and r2 can have different number of properties.
relation1:
index1: 10
index2: 2
relation2:
index1: 6
index2: 4
index3: 5
Is it possible to search among all properties without knowing their names? Or is there better way to keep lists in neo4j?
Property values can be lists, as long as all the elements are the same type. So you can have
match (A) -[r1]-> (B) -[r2]-> (C) set r1.vals = [10, 6], r2.vals=[6, 4, 5]
and later search with
match (A) -[r]-> (B) where 10 in r.vals return a,b
I don't know whether this works with indexing, so presumably tstorms' answer is better if you have a lot of these relationships.
There's no way to do this in "native" cypher, but you could use automatic relationship indexing that uses Lucene. I think you can do the following in Cypher:
START r=rel:rel_auto_index("*:'your_search_value'")
RETURN startNode(r), endNode(r), type(r);
Make sure automatic indexing is enabled in your Neo4j properties:
relationship_auto_indexing = true