## #StackBounty: #causality #dag What are simple examples of Bayesian Networks that don't work as *Causal* Bayesian Networks?

### Bounty: 50

I’m re-reading some of the early chapters of Pearl’s seminal Causality and I’m realizing that I can’t come up with more than 2 good examples of probability distribution, Bayesian Network pairs that fails as probability distribution, Causal Bayesian Network pairs.

From Pearl, the formal definition of a Causal Bayesian Network is:

A DAG $$G$$ is said to be a causal Bayesian network compatible with [the set of all intervention distributions] $$mathbf{P}_*$$ if and only if the following three conditions hold for every $$P_x in mathbf{P}_*$$:
(i) $$P_x(v)$$ is Markov relative to $$G$$;
(ii) $$P_x(v_i mid text{pa}_i) = 1$$ for all $$V_i in X$$ whenever $$v_i$$ is consistent with $$X = x$$;
(iii) $$P_x(v_i mid text{pa}_i) = P(v_i mid text{pa}_i)$$ for all $$V_i notin X$$ whenever $$text{pa}_i$$ is consistent with $$X = x$$, i.e. each $$P(v_i mid text{pa}_i)$$ remains invariant to interventions not involving $$V_i$$.

I’ve only come up with two potential counter-examples.

The first is the following: say we have $$X$$ which represents “clouds in the sky” and $$Y$$ which represents “it’s raining.” Now, say we postulate a graph, $$G$$, in which $$Y rightarrow X$$. In words, “rain causes clouds.”

In order to satisfy criterion (iii) in the above definition, $$P_{text{do}(Y = 1)}(X = 1 mid Y = 1)$$ must equal $$P(X = 1 mid Y = 1)$$. However, since rain does not in fact cause clouds, were we truly able to intervene on rain, we’d find that $$P_{text{do}(Y=1)}(X = 1 mid Y = 1)$$ would just equal $$P(X=1)$$. Thus, as our intuition would lead us to believe, the graph $$G$$ that represents “rain causes clouds” does not qualify as a Causal Bayesian Network.

My second example, of which I’m less sure, is the following: say we want to know the effect of some treatment ($$X$$), e.g. vitamins vs. no vitamins, on some health marker ($$Y$$). In order to do so, we’re going to run a randomized controlled trial, which will give us the intervention distribution for $$text{do}(X)$$ (for both possible values of $$X$$). Technically, we can deal with this by modeling the treatment assignment as a separate variable from the actual treatment (often done in instrumental variable analyses). However, say we instead model our experiment with a three (rather than 4) variable graph $$X rightarrow Y leftarrow U$$ (treatment $$X$$, outcome $$Y$$, unobserved confounding $$U$$) that conflates treatment with treatment assignment. In our intervention distribution generated by the randomized controlled trial, $$P_{do(X = x)}(X=x) < 1$$, violating criterion (ii).

I spent some time trying to generate other examples, in particular ones that violated criterion (i) but struggled to. Can others share more? I’d also love to have my second example (in|)validated!

Get this bounty!!!

## #StackBounty: #algorithms #graph-theory What are the common practices to weight tags relations?

### Bounty: 50

I am working on a webapp (fullstack JS) where the user create documents and attach tags to them. They also select a list of tags they are interested in and attach them to their profile.

I am not a math guy, but I did some NLP as hobbyist and learnt about latent semantic indexation: as I understand it, you create a table where you store each couple of words you parsed, and then add weight to each of these couple of words when both are found next to each other.

I was thinking of doing the same thing with tags: when 2 tags appear on the same document or profile, I increase the weight of their couple. That would allow me to get a ranking of the “closest” tags of a given one.

Then I remembered that I came across web graphs, where websites were represented in a 2D space (x and y coordinates) and placed depending on their links using an algorithm called force vector.

While I do know how I would implement my first idea, I am not sure about the second one. How do I spread the tag coordinates when created? Do they all have an `x:0, y:0` at the start?

Since I assume this is a common case of data sorting, I wondered what would be the common/best practices recommended by people of the field.

Is there documents, articles, libraries (npm?) or wikipedia pages you could point me out to help me understand what can or should ideally be done? Is my first option a good one by default?

Also, please let me know in comments if I should add or remove a tag to this question or edit its title: I’m not even sure of how to categorize it.

Get this bounty!!!

## #StackBounty: #android #audio #audio-streaming How to get an Audio Stream from Media Recorder in android

### Bounty: 50

I want to make streaming audio recorder in android. I am not sure how to fetch audio stream and how to set buffer size of audio stream.

Below is my media recorder class

``````public class MyMediaRecorder {

final MediaRecorder recorder = new MediaRecorder();
final File path;

/**
* Creates a new audio recording at the given path (relative to root of SD
* card).
*/
public MyMediaRecorder(File path) {
this.path = path;
}

/**
* Starts a new recording.
*/
public void start() throws IOException {
String state = android.os.Environment.getExternalStorageState();
if (!state.equals(android.os.Environment.MEDIA_MOUNTED)) {
throw new IOException("SD Card is not mounted.  It is " + state
+ ".");
}

// make sure the directory we plan to store the recording in exists

recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setOutputFile(path.getAbsolutePath());
recorder.prepare();
recorder.start();
}

/**
* Stops a recording that has been previously started.
*/
public void stop() throws IOException {
recorder.stop();
recorder.release();
}
}
``````

on start of recording i need to fetch a buffer size and sent it to server parallely record audio. Should I use Audio Record and Audio track instaed of Media Recorder ? Please suggest what should i do

Get this bounty!!!

## #StackBounty: #linux #networking #rhel Lost network connectivity to KVM guest vm's on host Network Restart

### Bounty: 50

I just restarted the network services in KVM host and running vm guest’s network were not reachable.

I enabled network to vm guest’s through Bridge. Only after guest reboot I could access the vm IP’s.

Why it causing issue for Network restart and how I will access the guest vm IP’s without rebooting.

Get this bounty!!!

## #StackBounty: #mariadb #amazon-rds Why isn't there a character-set-client-handshake RDS parameter for MariaDB 10.2 or 10.3?

### Bounty: 100

MariaDB has a parameter, –character-set-client-handshake, that can allow you to specify that the server should ignore the character set being specified by a client connecting.

On RDS, when you create a parameter group for a MariaDB v10.1 instance, this parameter is available for customization. But on v10.2 and v10.3 parameter groups, it is NOT present.

This parameter is also not present on the RDS list of MariaDB parameters not supported by MariaDB.

Searches for this have yielded no info.. can i be the only one that is looking for the character-set-client-handshake parameter for MariaDB v10.2 on RDS?

Get this bounty!!!

## #StackBounty: #wireless #network-manager Hotspot/Tethering but can't see the network

### Bounty: 50

I’m trying to set up a hotspot (a.k.a. AP, a.k.a. tethering) with my
desktop computer’s wireless card, which is also is connected to
internet via ethernet.

I get the green light in nmcli, but none of my devices can see the
network. I’ve ran into a couple of snags; having to turn radio on via
nmcli and also it does not work if it tries to claim the same IP
address twice. I’ve also tried using connman with the same result: all
clear on the desktop (i.e. the host AP computer) but devices can’t see
the network. What’s the next in my troubleshooting process?

Here are some deets of what’s going on:

``````ellen% uname -a
Linux ellen 5.3.0-26-generic #28-Ubuntu SMP Wed Dec 18 05:37:46 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
ellen% lspci -nn|grep Network
04:00.0 Ethernet controller [0200]: Intel Corporation I211 Gigabit Network Connection [8086:1539]
(rev 03)
05:00.0 Network controller [0280]: Realtek Semiconductor Co., Ltd. RTL8822BE 802.11a/b/g/n/ac
ellen% lsmod|grep rtw
rtwpci                 24576  0
rtw88                 471040  1 rtwpci
mac80211              851968  2 rtwpci,rtw88
cfg80211              712704  2 mac80211,rtw88
ellen% ls -d /usr/share/doc/dnsmasq
/usr/share/doc/dnsmasq
ellen% nmcli dev |head -2
DEVICE  TYPE      STATE      CONNECTION
wlp5s0  wifi      connected  Hotspot
ellen% sudo grep hidden /etc/NetworkManager/system-connections/Hotspot-1.nmconnection || echo No hidden
No hidden
ellen% nmcli dev  wifi list
IN-USE  SSID                          MODE   CHAN  RATE      SIGNAL  BARS  SECURITY
*       A lone doorframe in the wall  Infra  1     0 Mbit/s  0       ____  WPA1 WPA2
ellen% ip a s dev wlp5s0
3: wlp5s0: <BROADCAST,MULTICAST,DYNAMIC,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default
qlen 1000
link/ether 80:91:33:7e:80:21 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.8/24 brd 192.168.0.255 scope global noprefixroute wlp5s0
valid_lft forever preferred_lft forever
inet6 fe80::8291:33ff:fe7e:8021/64 scope link
valid_lft forever preferred_lft forever
ellen% /sbin/iwconfig wlp5s0
wlp5s0    IEEE 802.11  Mode:Master  Tx-Power=20 dBm
Retry short limit:7   RTS thr:off   Fragment thr:off
Power Management:on
``````

I can’t check on the clients because they are things like video games, ebook readers, printers etc (that worked fine on my old AP).

Antenna yes. But it has two wires, are they equivalent to each other
or does one specific wire need to go to one specific contact?

Update! In /var/log/syslog I found two weird things!
The first:

``````Jan 24 15:40:38 ellen wpa_supplicant[870]: wlp5s0: CTRL-EVENT-SCAN-FAILED ret=-95 retry=1
``````

I’ve gotten rid of by adding into a file in `/etc/NetworkManager/conf.d` like this:

``````[device]
match-device=driver:rtw88
``````

The second:

``````Jan 24 15:40:37 ellen wpa_supplicant[870]: MGMT: BSSID=5e:6a:80:7b:60:90 not our address
``````

I have no idea. I’m not sure where the “5e:6a:80:7b:60:90” comes from.

Get this bounty!!!

## #StackBounty: #magento2 #module #di #extend #magento-framework Magento 2 – Extend core framework

### Bounty: 50

I need to add a new attribute for layout containers.

e.g.:

customAttribute=”data-block=’minicart'”

``````<container name="minicart-row" htmlTag="div" htmlClass="minicart-wrapper" customAttribute="data-block='minicart'">
``````

I can solve this by editing the core at `vendor/magento/framework`.
I already solved it by editing these files:

• vendor/magento/framework/View/Layout.php
• vendor/magento/framework/View/Layout/Element.php
• vendor/magento/framework/View/Layout/etc/elements.xsd
• vendor/magento/framework/View/Layout/Generator/Container.php

but editing the core is not clean obviously…

So I created a new module app/code/Core/Extend to get started, but It already fails at the first class.

View/Layout.php:

``````<?php
namespace CoreExtendView;

use MagentoFrameworkAppObjectManager;
use MagentoFrameworkAppState as AppState;
use MagentoFrameworkCacheFrontendInterface;
use MagentoFrameworkEventManagerInterface;
use MagentoFrameworkExceptionLocalizedException;
use MagentoFrameworkMessageManagerInterface as MessageManagerInterface;
use MagentoFrameworkSerializeSerializerInterface;
use MagentoFrameworkViewLayoutElement;
use PsrLogLoggerInterface as Logger;

/**
* Layout model
*
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.TooManyFields)
* @SuppressWarnings(PHPMD.ExcessivePublicCount)
* @SuppressWarnings(PHPMD.TooManyMethods)
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
class Layout extends MagentoFrameworkViewLayout
{

public function __construct(
LayoutProcessorFactory \$processorFactory,
ManagerInterface \$eventManager,
LayoutDataStructure \$structure,
MessageManagerInterface \$messageManager,
DesignThemeResolverInterface \$themeResolver,
LayoutGeneratorPool \$generatorPool,
FrontendInterface \$cache,
LayoutGeneratorContextFactory \$generatorContextFactory,
AppState \$appState,
Logger \$logger,
\$cacheable = true,
SerializerInterface \$serializer = null
) {
parent::__construct(
\$processorFactory
, \$eventManager
, \$structure
, \$messageManager
, \$themeResolver
, \$generatorPool
, \$cache
, \$generatorContextFactory
, \$appState
, \$logger
, \$cacheable
, \$serializer
);
}

}
``````

etc/di.xml:

``````<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="MagentoFrameworkViewLayout"
type="CoreExtendViewLayout" />
</config>
``````

Then I executed `php bin/magento setup:upgrade`.

But If I reload the site, then I get

Exception #0 (ReflectionException): Class CoreExtendViewLayoutInterceptor does not exist

Where is the problem? And even after I solve this, how can I extend the file elements.xsd then?

Get this bounty!!!

## #StackBounty: #php #laravel Laravel logging.channels.single.path with queue is cached?

### Bounty: 50

Im using `Queue::before` in AppServiceProvider.php and set `logging.channels.single.path` value every time when job started:

``````config(['logging.channels.single.path' => storage_path('logs/accounts/'.\$command->acc->login.'.log')]);
``````

When I running 1 job all ok – logs in the right place.
When running 2 or more it writing logs to different files – one account can write to another accounts logfile. Why is it happening? It looks like it is caching the config variable.

Queue on horizon redis. One job after done dispatching another same job with the same \$acc instance.

Get this bounty!!!

## #StackBounty: #wireless #network-manager Hotspot/Tethering but can't see the network

### Bounty: 50

I’m trying to set up a hotspot (a.k.a. AP, a.k.a. tethering) with my
desktop computer’s wireless card, which is also is connected to
internet via ethernet.

I get the green light in nmcli, but none of my devices can see the
network. I’ve ran into a couple of snags; having to turn radio on via
nmcli and also it does not work if it tries to claim the same IP
address twice. I’ve also tried using connman with the same result: all
clear on the desktop (i.e. the host AP computer) but devices can’t see
the network. What’s the next in my troubleshooting process?

Here are some deets of what’s going on:

``````ellen% uname -a
Linux ellen 5.3.0-26-generic #28-Ubuntu SMP Wed Dec 18 05:37:46 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
ellen% lspci -nn|grep Network
04:00.0 Ethernet controller [0200]: Intel Corporation I211 Gigabit Network Connection [8086:1539]
(rev 03)
05:00.0 Network controller [0280]: Realtek Semiconductor Co., Ltd. RTL8822BE 802.11a/b/g/n/ac
ellen% lsmod|grep rtw
rtwpci                 24576  0
rtw88                 471040  1 rtwpci
mac80211              851968  2 rtwpci,rtw88
cfg80211              712704  2 mac80211,rtw88
ellen% ls -d /usr/share/doc/dnsmasq
/usr/share/doc/dnsmasq
ellen% nmcli dev |head -2
DEVICE  TYPE      STATE      CONNECTION
wlp5s0  wifi      connected  Hotspot
ellen% sudo grep hidden /etc/NetworkManager/system-connections/Hotspot-1.nmconnection || echo No hidden
No hidden
ellen% nmcli dev  wifi list
IN-USE  SSID                          MODE   CHAN  RATE      SIGNAL  BARS  SECURITY
*       A lone doorframe in the wall  Infra  1     0 Mbit/s  0       ____  WPA1 WPA2
ellen% ip a s dev wlp5s0
3: wlp5s0: <BROADCAST,MULTICAST,DYNAMIC,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default
qlen 1000
link/ether 80:91:33:7e:80:21 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.8/24 brd 192.168.0.255 scope global noprefixroute wlp5s0
valid_lft forever preferred_lft forever
inet6 fe80::8291:33ff:fe7e:8021/64 scope link
valid_lft forever preferred_lft forever
ellen% /sbin/iwconfig wlp5s0
wlp5s0    IEEE 802.11  Mode:Master  Tx-Power=20 dBm
Retry short limit:7   RTS thr:off   Fragment thr:off
Power Management:on
``````

I can’t check on the clients because they are things like video games, ebook readers, printers etc (that worked fine on my old AP).

Antenna yes. But it has two wires, are they equivalent to each other
or does one specific wire need to go to one specific contact?

Update! In /var/log/syslog I found two weird things!
The first:

``````Jan 24 15:40:38 ellen wpa_supplicant[870]: wlp5s0: CTRL-EVENT-SCAN-FAILED ret=-95 retry=1
``````

I’ve gotten rid of by adding into a file in `/etc/NetworkManager/conf.d` like this:

``````[device]
match-device=driver:rtw88
``````

The second:

``````Jan 24 15:40:37 ellen wpa_supplicant[870]: MGMT: BSSID=5e:6a:80:7b:60:90 not our address
``````

I have no idea. I’m not sure where the “5e:6a:80:7b:60:90” comes from.

Get this bounty!!!

## #StackBounty: #causality #dag What are simple examples of Bayesian Networks that don't work as *Causal* Bayesian Networks?

### Bounty: 50

I’m re-reading some of the early chapters of Pearl’s seminal Causality and I’m realizing that I can’t come up with more than 2 good examples of probability distribution, Bayesian Network pairs that fails as probability distribution, Causal Bayesian Network pairs.

From Pearl, the formal definition of a Causal Bayesian Network is:

A DAG $$G$$ is said to be a causal Bayesian network compatible with [the set of all intervention distributions] $$mathbf{P}_*$$ if and only if the following three conditions hold for every $$P_x in mathbf{P}_*$$:
(i) $$P_x(v)$$ is Markov relative to $$G$$;
(ii) $$P_x(v_i mid text{pa}_i) = 1$$ for all $$V_i in X$$ whenever $$v_i$$ is consistent with $$X = x$$;
(iii) $$P_x(v_i mid text{pa}_i) = P(v_i mid text{pa}_i)$$ for all $$V_i notin X$$ whenever $$text{pa}_i$$ is consistent with $$X = x$$, i.e. each $$P(v_i mid text{pa}_i)$$ remains invariant to interventions not involving $$V_i$$.

I’ve only come up with two potential counter-examples.

The first is the following: say we have $$X$$ which represents “clouds in the sky” and $$Y$$ which represents “it’s raining.” Now, say we postulate a graph, $$G$$, in which $$Y rightarrow X$$. In words, “rain causes clouds.”

In order to satisfy criterion (iii) in the above definition, $$P_{text{do}(Y = 1)}(X = 1 mid Y = 1)$$ must equal $$P(X = 1 mid Y = 1)$$. However, since rain does not in fact cause clouds, were we truly able to intervene on rain, we’d find that $$P_{text{do}(Y=1)}(X = 1 mid Y = 1)$$ would just equal $$P(X=1)$$. Thus, as our intuition would lead us to believe, the graph $$G$$ that represents “rain causes clouds” does not qualify as a Causal Bayesian Network.

My second example, of which I’m less sure, is the following: say we want to know the effect of some treatment ($$X$$), e.g. vitamins vs. no vitamins, on some health marker ($$Y$$). In order to do so, we’re going to run a randomized controlled trial, which will give us the intervention distribution for $$text{do}(X)$$ (for both possible values of $$X$$). Technically, we can deal with this by modeling the treatment assignment as a separate variable from the actual treatment (often done in instrumental variable analyses). However, say we instead model our experiment with a three (rather than 4) variable graph $$X rightarrow Y leftarrow U$$ (treatment $$X$$, outcome $$Y$$, unobserved confounding $$U$$) that conflates treatment with treatment assignment. In our intervention distribution generated by the randomized controlled trial, $$P_{do(X = x)}(X=x) < 1$$, violating criterion (ii).

I spent some time trying to generate other examples, in particular ones that violated criterion (i) but struggled to. Can others share more? I’d also love to have my second example (in|)validated!

Get this bounty!!!