Efficient top eigenvalue computation for Hessian of neural networks

I train a neural network – one of the Resnet variations ($approx 10^7$ parameters) on the CIFAR-10 dataset – and after each epoch, I would like to find the smallest/largest eigenvalues of its Hessian. For that, I can use hessian-vector products (i.e. $f(v) = H v$, where $H$ is the Hessian corresponding to the batch I’m currently using, PyTorch has a built-in mechanism for that), so, for example, I can use the power method. However, the pure power method will be very slow: one needs a pass over the entire data to compute the true Hessian-vector product.

Question: do you know of an efficient algorithm for this task? To be precise, I mean that both eigenvalues can be computed with a reasonable multiplicative error within at most 10 minutes.

Note that I’m asking about an algorithm that you know to be efficient for this (or similar) problem. I tried the power method, accelerated power method, stochastic power method, Oja’s algorithm, gradient-based algorithm, its accelerated version, algorithms from https://arxiv.org/abs/1707.02670. All these experiments take a lot of time and so far I didn’t have any success, no matter how much engineering I used. When eigenvalues are close to $0$ (e.g. of order $-frac 12$, when the largest eigenvalue is of order $100$), either convergence takes a lot of time or the results are unstable/unreliable.
Just in case, I’m aware of PyHessian (and the first version of my code is based on theirs).

graphs – why does relabel take O(VE) time total for unit capacity flow networks?

It is well known that for arbitrary flow networks, Goldberg’s push-relabel algorithm takes $O(V^2E)$. Part of that comes from $O(V^2E)$ non-saturating pushes. Another part comes from $O(V)$ relabelling operations per vertex, each taking $O(V)$ time, for a total of $O(V^3)$ for all relabelling operations.

I’m interested in what happens to these bounds when we restrict edge capacities to be 1. It is clear that there are no more non-saturating pushes, so only saturating pushes, of which there are always $O(VE)$, remain.

However, I found a 1995 phd thesis by a student of Goldberg that claims (on p 13) that when edge capacities are 1 (and thus all pushes are saturating), the relabelling portion takes $O(VE)$ time instead of the usual $O(V^3)$.

How does this $O(VE)$ result follow?

docker – Is there any value in using macvlan/VLANs to create router aware networks to segment internet exposed containers vs non exposed containers?

I have a single home server with a single NIC. I intend to run numerous Docker containers — some will be internet exposed, some will not.

The way I see it, I have two options:

  1. Use the normal bridge network driver:
    1. Create 2 unique bridge networks to segment the traffic:
      1. One for internet exposed Docker containers
      2. One for non-internet exposed containers
    2. Use -p in my docker run to expose my hosts ports for containers
    3. Use port forwarding on my router to redirect WAN ports to the necessary ports on host
    4. For example:
      1. Docker networks: network1 and network2
      2. Docker containers: container1 on network1 and container2 on network2
      3. host:1234 maps to :2345 of container1 on network1
      4. host:5678 maps to :6789 of container2 on network2
      5. Port forwarding of my router to forward WAN:443 to host:1234
  2. Use macvlan:
    1. Create router aware VLAN networks in Docker with containers in their own VLAN network
    2. No need to use -p with docker run since the containers have router aware IPs and I can just access them using [IP of container]:[service port]
    3. Use port forwarding on my router to redirect WAN ports to to the IP of the container
    4. For example:
      1. Docker networks: network3 on eth0.30 and network4 on eth0.40
      2. Docker containers: container3 on network3 and container4 on network4
      3. port forward WAN:443 to the [IP of container3]:2345

Both give the same end result. macvlan makes my containers router aware. One way the traffic is segmented by Docker, and one they are segmented by my router and the 802.1q trunk.

I appreciate any thoughts, perspective, advice. TIA!

networking – How do I use iptables to forward a request from SNAT/DNATed networks to a specific VPN gateway

I have a system with multiple IP addresses and several Docker networks. I’ve disabled Docker’s built-in masquerading, so I can have each network only send and receive to certain public IP addresses. In addition I have a wireguard setup to connect this servers to others, running on the space.

I realize I could just use MASQUERADING, but I run some containers that ignore DNS servers and host entries (specifically Mastodon has it’s own DNS resolver which ignores the system resolver) and I also needed those containers to communicate across these networks, so that’s why there are individual SNAT and DNAT rules.

-A INPUT -p icmp -j ACCEPT
# wireguard server
-A INPUT -d -p udp --dport 90500 -j ACCEPT
# wireguard internetal network
-A INPUT -d -p all -j ACCEPT
-A POSTROUTING -s ! -o am-public -j SNAT --to-source
-A POSTROUTING -s ! -o am-anon   -j SNAT --to-source
-A POSTROUTING -s ! -o am-apps   -j SNAT --to-source
-A POSTROUTING -s ! -o am-services   -j SNAT --to-source
-A PREROUTING -d -p tcp -j DNAT --to-destination
-A PREROUTING -d -p tcp -j DNAT --to-destination
-A PREROUTING -d -p tcp -j DNAT --to-destination
-A PREROUTING -d -p tcp -j DNAT --to-destination

On this setup, the host system can get to services running on the wireguard VPN (e.g. something like curl will work from this host). However, I cannot get to services over the VPN from within containers on the user defined networks.

I suspect it is because the source NAT forces all traffic from that network to a public IP address, bypassing routes that would sent that traffic to the VPN (wg0 at I’ve tried rules such as iptables -t nat -A POSTROUTING -s -d -j SNAT --to-source or forwarding such as iptables -A FORWARD -p tcp -s -d -j ACCEPT, but nothing seems to work. Containers on the default Docker bridge network with standard masquerading enabled can reach the correct server on the VPN.

I’ve also wondered if I could add a second ! -o wg0 so those packets wouldn’t be covered by the rules, but iptables only supports one -o.

What do I need to do in order to have traffic from user-defined Docker networks to reach the wireguard VPN with this setup?

1000 Social Networks Profile Backlinks + Premium Indexer for $8

1000 Social Networks Profile Backlinks (MIX – Do Follow / No Follow For Best Search Engine Practice)
You will receive 1000 Social Networks Profile Backlinks + Premium Index For Free
So what will you get and why Should you Buy?

Social Network profiles (sites with social network platform is NOT like the major social networks) Some links will come with link as an anchor text. Mix do-follow and no-follow links Multiple links/keywords accepted for each order
Full details reports including each created links/accounts
All The Backlinks Will Be Premium Indexed For Free If You ORDER NOW Fast Turn-Around (4 Days Approximately) Save 50% If You ORDER Now

by: NesimSEO
Created: —
Category: Link Development
Viewed: 472


computer networks – Can someone explain how they were able to calculate what time each host started and finished?

enter image description hereThe diagram at right shows a WIFI network with an
access point, X and three hosts, A, B and C. The large circles
indicate the coverage areas of the three hosts. The coverage area
for X is not shown, but you may assume that it includes all three
hosts. Assume RTS/CTS are not used.
Suppose X is transmitting a packet at time 0 and finishes sending it at time 100 µs. Also,
• A gets a packet to send at time 50 that takes 100 µs to send and is assigned a backoff timer
of 70.
• B gets a packet at time 70 that takes 200 µs and is assigned a backoff timer of 200.
• C gets a packet at time 120 that takes 150 µs and is assigned a backoff timer of 150.
For each of the three hosts, what time do they start sending their packets? You may ignore
the inter-frame spacing and the time required for acks.
A starts sending at time 170
B starts sending at time 300
C defers while A is sending, so it starts at time 120+100+150=370
Of the three packets sent, which are successfully delivered on the first attempt?
Only the packet from A is delivered.

graphs and networks – How to find mean and median number of links of neighboring nodes

I’m trying to work out how to identify both the mean and median number of links attached to neighboring nodes when iterating through nodes A1 to B5. Below I have an example matrix, given as matrixlist, it’s visualization, given as matrixvisualization and the corresponding adjacency graph, graph:

matrixlist = {{1, 1, 0, 0, 0, 0, 1, 0, 0, 0}, {1, 0, 0, 0, 1, 1, 0, 0,
    1, 0}, {0, 0, 0, 0, 1, 1, 0, 0, 0, 1}, {0, 0, 0, 0, 0, 0, 0, 0, 0,
    0}, {0, 1, 1, 0, 0, 0, 0, 0, 1, 1}, {0, 1, 1, 0, 0, 0, 1, 0, 0, 
   1}, {1, 0, 0, 0, 0, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 
   0}, {0, 1, 0, 0, 1, 0, 0, 0, 0, 0}, {0, 0, 1, 0, 1, 1, 0, 0, 0, 0}}

matrixvisualization = MatrixForm(matrixlist, 
 TableHeadings -> {{"A1", "A2", "A3", "A4", "A5", "B1", "B2", "B3", 
    "B4", "B5"}, {"A1", "A2", "A3", "A4", "A5", "B1", "B2", "B3", 
    "B4", "B5"}})

graph = AdjacencyGraph(verticeLabel, matrixlist,  
  VertexLabels -> Placed("Name", Center),
  VertexSize -> .8,
  VertexStyle -> White)

I’ve included a picture of the graph to help with the explanation of what I’m trying to obtain. I would like to figure out how to find the mean number of links off neighboring nodes for each of the nodes present in the graph.

For example, in the graph provided, node A1 has two neighbors, A2 and B2. A2 has a total of 4 links off of it and B2 has two links. Therefore, the mean number of links off neighboring nodes with respect to A1is 3. Taking the same idea and applying it to the next node sequentially, A2, the mean number of links off neighboring nodes with respect to A2 would be 3.25 (Loops are only counted as 1 additional link so A1 has 3 links in total). I would like to repeat this process for each node in the graph and then create a list which contains the averages.

meannewlist = {3, 3.25 ...}

Taking the same process above, I’m also trying to find out the medium number of links off neighboring nodes for each node. For example if we start at A1, the median number of neighboring links with respect to A1 is 3 (coincidentally the same as its average number found above). As mentioned above, I would like to list all the median values in a list:

 mediannewlist = {3, 3.25...}

Any insight as to how I might solve this would be greatly appreciated.

enter image description here

wifi – When connected to two networks, can I tell my iMac to use a specific network for a certain application?

I run Spotify on wifi network “Production Internet”. As the name implies, that network has internet access.

I’d also like to run Audiofusion SoundCaster over a separate hardwired network that doesn’t have internet access. Well, actually the iMac would be hardwired to a different wifi router with no internet access. So the SoundCaster traffic eventually goes over a wifi network called “Monitors”. “Monitors” doesn’t have internet access, though. It only carries SoundCaster traffic between iPhones and the iMac.

I don’t want SoundCaster traffic going over “Production Internet”. How can I force all SoundCaster traffic to go to the hardwired connection so it is sent to the wifi router for “Monitors”?

Thanks for your help.

computer networks – Is there any guarantee in asynchronous systems?

Thanks for contributing an answer to Computer Science Stack Exchange!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.

To learn more, see our tips on writing great answers.

graphs and networks – Grouping the list

Let’s assume that I have randomly generated list

 llist = {{0, 1}, {2, 1}, {4, 4}, {0, 3}, {3, 4}, {2, 2}, {0, 1}, {2, 3}, {2, 0}};

We can represent this data using the following plot,

enter image description here

I want to group the elements, but I can only group them by same x elements or y elements.

For example, if I group them with the same x elements, I got five groups,

enter image description here


If I group them with the same y elements, I got four groups

enter image description here

{{{0, 1},{0, 3}},{{2, 1},{2, 2},{2, 3},{2, 0}},{{3, 4}},{{4, 4}}}

However, if I group them with x and y simultaneously, I can reduce the group by three.

enter image description here

I can code them by coding them by trying all possible grouping one by one with If and Length, but it seems very inefficient coding. Any suggestions?