exp( 0 + ( ) ), which only contains the basis functions without the alpha function to capture the synaptic baseline null model, without a fast, synaptic effect. While learned bases capture slow structure in the cross-correlograms across all pairs, we also aim to describe 187 structure in the fast, synaptic effects for each presynaptic neuron. In the full model, we include two structural 188 constraints: 1) we constrain the latency of synaptic connections to increase with increasing distance between 189 neurons, and 2) we constrain presynaptic neurons to either excite or inhibit all of their postsynaptic targets, in 190 accordance with Dale's law. Together, these constraints have the potential to improve detection of weak 191 connections that are consistent with the constraints and rule out the false positives that are inconsistent. 192 193 Estimation of the "conduction velocity" 194 To implement the constraint that synaptic latencies should increase with distance, we estimate an approximate 195 "conduction velocity" for each presynaptic neuron based on the distances between neurons and the estimated synaptic latencies from stage 1 above. Physiologically, conduction velocities vary as a function of axon diameter presynaptic neuron type, for each presynaptic neuron , we fit all the cross-correlograms 1 , 2 , … using full 224 model twice, once constraining ≥ 0 ( excitatory model) and once constraining ≤ 0 (inhibitory model). 225
Here we determine the presynaptic neuron type using the log likelihood ratio of the excitatory model fit to the 226 inhibitory model fit. If the log likelihood ratio is positive, this suggests that the excitatory model provides a better description of the 229 correlogram than the inhibitory model. For each presynaptic neuron, we use the single neuron pair with the 230 largest likelihood ratio between two models to classify the neuron type (we tried using several weighting schemes, 231 such as the average across all pairs or the top-5 pairs, but for the simulations and datasets used here the 232 top-1 pair performed the best of these schemes). We classify the presynaptic neuron as a putative excitatory 233 neuron if ± > 0, or as a putative inhibitory neuron if ± < 0. After the neuron type classification, we only 234 adopt the corresponding full model (excitatory/inhibitory model based on the presynaptic neuron type) to later 235 determine whether there is a putative synaptic connection. We label all the putative connections from an 236 excitatory presynaptic neuron as putative excitatory connection, and all the putative connections from an 237 inhibitory presynaptic neuron as putative inhibitory connections. 238 239
To examine how our model-based synapse detection approach performs we build two simulated networks of 241 modified leaky integrate-and-fire (LIF) neurons. In real data, the shapes of cross-correlograms of two neurons 242 can be affected by both the background activity of the network (external input shared by the network), and the 243 patterns of presynaptic activity (e.g. high vs low firing rate, bursting). Here we designed two distinct simulations 244 to capture these effects. In a first simulation we model a network of recurrently connected neurons that all receive 245 background common input, creating slow fluctuations in the cross-correlograms similar to those observed in real 246 data (Simulation 1 with common inputs). In a second simulation we then model a set of neurons receiving 247 presynaptic inputs from experimentally observed spikes, creating presynaptic spike patterns similar to those 248 present in real data (Simulation 2 with real presynaptic inputs). 249 250 For Simulation 1 with common inputs, we build a simplified, simulated network of adaptive leaky integrate-and-fire neurons with current-based synaptic inputs. 300 neurons are included in the simulation -80% excitatory, 20% inhibitory. All the neurons are randomly distributed in a square area. The neurons are randomly connected, and 253 only the neuron pairs whose distances are less than the median distance have synaptic connections. The 254 connection probability is set to be 5% for the excitatory presynaptic neurons (Holmgren et al. 2003) and 20% for 255 the inhibitory presynaptic neurons to balance the excitatory and inhibitory inputs (Barral and D'Reyes 2016; 256 Dehghani et al. 2016; Haider et al. 2006) . 60 minutes of current input and voltage recording for each neuron are 257 simulated with a simulated sampling rate 10kHz for this network. The mean firing rate of all the neurons is 4.3Hz. 258
In this modified LIF model (based on (Liu and Wang 2001)), the membrane potential dynamics are affected by 259 three currents: 1) a leak current, 2) an after-hyperpolarization current, and 3) synaptic input 260 Here the dynamics of the membrane potential are governed by leaky integration of the input current, but every 267 time the neuron spikes Ca-currents lead to an after-hyperpolarization, preventing the neuron from spiking rapidly. 268
In the modified LIF model, when the membrane potential reaches the threshold ℎ ,the neuron spikes, is 269 reset to , and [ 2+ ] increases by the amount . The input current to each postsynaptic neuron is given by 272
where is 1/ noise independently generated for each neuron, is 1/ noise shared by the whole 274 network. Each neuron receives the common input with random latencies ∆ to simulate the slow fluctuation 275 caused by background common input, and is the random common input weight. , denotes the synaptic 276 current from the th presynaptic input added to the postsynaptic neuron with a synaptic latency ∆ after each 277 presynaptic spike at ,
, is the synaptic weight randomly 278 drawn from a bounded log-normal distribution -positive when the connection is excitatory and negative when 279 the connection is inhibitory. Note that, since max ( 1− ) = 1, sets the amplitude of individual Post synaptic 280 current (PSC) in units of nA. Here we also give each presynaptic neuron a random "conduction velocity" and 281 set the synaptic latency according to ∆ = / . This simulated network, thus, obeys the rule that synaptic 282 latencies increase linearly with the distances between presynaptic neuron and postsynaptic neuron (see Table  283 1 for parameters). 284
In Simulation 2 with real presynaptic inputs, we model 300 adaptive leaky integrate-and-fire neurons that receive 286 input from 300 neurons whose spike trains are from an in vitro multielectrode array recording. We randomly 287 assign 80% of the 300 presynaptic neurons to be excitatory neurons and the rest to be inhibitory. The connection 288 probability, connection rules, and LIF parameters are the same as in the first simulation (see Table 1 ). Here the 289 simulated sampling rate is 20Hz, which was used in the in vitro recording, and the input currents do not contain ( − ̅ )/ for each bin and compare this to a critical value . If there is at least one bin within the interval 304 of interest that exceeds the upper threshold , the connection from neuron i to neuron j is labeled as an excitatory 305 connection. Similarly, if there is at least one bin within the interval below the lower threshold − , the connection 306 from neuron to neuron is labeled as an inhibitory connection. In practice, the threshold can be adjusted to 307 optimize the number of false positives/negatives. In comparing models, we use ROC curves to examine all 308 thresholds (see below). 309
One potential problem with the thresholding method is that the baseline for a correlogram is often not constant. 311
To address this, an alternative method (Fujisawa et al. 2008; Hatsopoulos et al. 2003 ) uses jittered spike trains 312 to generate a baseline cross-correlogram that keeps the shape of the slow fluctuation while removing fast 313 synaptic effects. With the jitter method, the presence of synaptic connections can then be inferred by testing if 314 there is a peak or trough that is significantly different from this time-varying baseline. Here we use a variant of 315 this method where, for each neuron, we randomly and independently jitter each spike on a uniform interval of [- Evaluating methods for synapse detection 326
Using the simulations described above we evaluate our model-based synapse detection method alongside the 327 thresholding method and jitter method. Benchmarking the performance of synapse detection methods on real 328 extracellular recordings is difficult,since we are almost always uncertain about whether or not two neurons are 329 monosynaptically connected. However, with simulations, the ground-truth connectivity is known, and we can 330 compare the detection accuracy for different methods. Here we use receiver operating characteristic (ROC) 331 curves, specifically comparing false positive and true positive rates. Since the number of true positives is small 332 (less that ~5%), these rates and the area under the ROC curve (AUC) give a more accurate impression of the 333 detection performance than the overall accuracy and can be calculated without a set threshold. The scores we 334 use to determine whether there is a synaptic connection in generating the ROC curves vary for the three methods. 335
For the model-based method developed here, we use the log likelihood ratios of full model to slow model, while 336 for thresholding and jitter methods, we use the largest z-score within the [0,10] ms interval. 337
The ROC curves measure the overall performance of different methods on a series of thresholds. But when we 339 apply the method to real data and plan to make decisions on synapse detection, we still need to specify a 340 threshold. The choice of threshold has a large effect on the detection of putative synaptic connections. A 341 threshold that is too strict will result in a large number of false negatives, while a threshold that is not strict enough 342 will result in a large number of false positives. The uncertainty and diversity of the real datasets make it difficult 343 to pick the optimal threshold. Here, for illustration, we pick the threshold based on the results in our simulated 344 network (we pick Simulation 1 here since the threshold based on Simulation 1 is stricter). Since synaptic 345 connections are relatively rare compared to the total number of neuron pairs, we use Matthews correlation where is the number of true positives, is the number of true negatives, is the number of false negatives, and is the number of false negatives. For the model-based method, the maximum MCC is .86 351 (TPR = 84.83%, FPR = 0.09%) for Simulation 1, the corresponding threshold is 4.64 (log likelihood ratio). It may 352 be valuable to note that this threshold is relatively close to the decision rule that would be given by minimizing 353 the Akaike or Bayesian Information Criteria (AIC or BIC), where the log likelihood ratios would need to be greater 354 than 3 or ~6.9, respectively (based on = 3 extra parameters and = 100 bins of observations). For jitter 355 method, the maximum MCC is .69 (TPR = 60.23%, FPR = 1.02%), the corresponding threshold is 3.59 (z-score) 356
for Simulation 1. In comparing the results from different synapse detection methods with real data, we pick the 357 thresholds for our method and the jitter method based on these maximum MCC results from the simulation. 
To examine how these methods detect putative synaptic connections in experimental data we use in vitro 367 recordings of spontaneous activity from organotypic slice cultures of mouse somatosensory cortex made using 368 a large and dense multielectrode array (512 electrodes, 60 μm interelectrode spacing, 5 μm electrode diameter, 369 flat electrodes, roughly 1 mm by 2 mm total array area). The angle of the slices was approximately coronal, but To simulate the network with real data input (Simulation 2), we used spike trains from the highest firing rate 381 neurons combined from two datasets (datasets 16 and 23), choosing 300 neurons in total (out of 904 possible). 382
The mean firing rate of the 300 neurons was 5.57Hz (min: 1.88Hz, max: 44.55Hz). 383
For examining putative synaptic connectivity in the experimental data, we use dataset #13 (number of neurons: 385 381, mean firing rate: 1.95 Hz) and dataset #23 (number of neurons: 310, mean firing rate: 2.81 Hz). Here we 386 exclude the neurons with less than 1000 spikes recorded, 68 neurons (17.85%) are excluded from dataset #13, 387 21 neurons (6.77%) are excluded from dataset #23. Before we apply the detection methods on these datasets, 388
we also exclude the neuron pairs where the correlogram may be misestimated due to the way that spike trains 389 were sorted. If the waveforms of two neurons show up on the same set of electrodes, near simultaneous spikes 390 tend to overlap and be sorted inaccurately (Pillow et al. 2013 , "spike shadowing"). Here, we calculate a spike 391 sorting index = { − , − } to exclude the cross-correlograms with a peak or trough near = 0. Here 392 is the total number of counts within 1.5 ms of the center of the correlogram (3 bins), is the total number of 393 counts within 1.5 ms (3 bins) that are to the left of the center, is the total number of counts within 1.5 ms (3 394 bins) that are to the right of the center. We exclude the neuron pairs when the spike sorting index is greater 395 than 0.5. Based on this rule, 6.51% of the neuron pairs are excluded from dataset #13, 5.55% of the neuron 396 pairs are excluded from dataset #23. 397 398
Here we develop an extension of a generalized linear model (GLM) to describe the correlograms between pairs 400 of neurons. This model aims to separate the cross-correlogram between each pair of neurons into two parts: 1) 401 a slow effect caused by fluctuating firing rates and common input from other neurons, which is fit using a group 402 of smooth basis functions learned from the data, and 2) a fast effect caused by the synaptic connection, which 403 is fit by a short-latency, fast onset alpha function (Fig. 1A) . In this study, we model the time interval between -25 404 ms to 25 ms, with a binsize of 0.5 ms. To determine whether or not a given pair of neurons might be synaptically 405 connected we then compare the full model with a reduced model that has the slow effect but not the fast effect. latencies tend to increase with the distance between the pre-and postsynaptic neuron (Fig. 1C ). Here we assume 417 a linear relationship between distance and latency and estimate a "conduction velocity" for each presynaptic 418 neuron. If this relationship is clearly linear, the possible latencies for other connections can be constrained. 419
Together, these two constraints may act to better detect the weak connections and exclude the false positives 420 that violate the expected structure (see more details in methods). 
To evaluate our model, we build two simulated networks of adaptive leaky integrate-and-fire (LIF) neurons: 434
Simulation 1 with common inputs, a network of 300 recurrently connected LIF neurons receiving slow, 435 background common input, and Simulation 2 with real presynaptic inputs, a network of 300 unconnected LIF 436 neurons receiving input from a set of experimentally recorded spike trains. In the first simulation, 80% of the 437 neurons are randomly assigned to be excitatory, with the rest being inhibitory. The neurons are randomly connected to each other with a connection probability of 5% for the excitatory presynaptic neurons and 20% for normal distribution, similar to results from in vitro observations (Song et al. 2005 ). In addition to the synaptic 441 input, all neurons receive background common input from a single slowly fluctuating, noisy source with a random 442 delay (see Methods). This common input produces baseline fluctuations in the cross-correlograms similar to 443 what is frequently observed in the real data (Fig 2A) . Additionally, we assign each presynaptic neuron a 444 "conduction velocity" and make the synaptic latencies between neurons distance-dependent. In Simulation 1, 
A central assumption of the model-based detection approach used here is that neuron type and latency 476 constraints can, in principle, allow information to be shared across the connections made by a presynaptic neuron. 477
However, in order for these constraints to be useful, the model must be able to accurately estimate both whether 478 a presynaptic neuron is excitatory or inhibitory and the presynaptic neuron's "conduction velocity" from noisy 479 spiking data. Therefore, before evaluating whether these constraints improve detection, we determine how 480 accurately we can recover neuron type and "conduction velocity" in each of the simulations.
can then estimate the type of each presynaptic neuron by asking which of the two models provides a better 485 description of the cross-correlograms involving that presynaptic neuron (see Methods). Using our model, in 486
Simulation 1 with common inputs, 97.7% of the neurons are labeled correctly (7 out of 300 mislabeled). In 487
Simulation 2 with real presynaptic inputs, 95% of the neurons are labeled correctly (15 out of 300 mislabeled). 488
In this case the mislabeled neurons are also relatively low-firing rate (mean firing rate = 3.31 Hz, compared to 489 5.57 Hz for all presynaptic neurons). 490
We then evaluate how well we can estimate each presynaptic neuron's conduction velocity from the cross-492 correlograms. Here we estimate the synaptic latency between each pair of neurons and use a weighted linear 493 regression to then estimate the "conduction velocity" of each presynaptic neuron (see Methods). Using this 494 approach, we find that we can recover the true velocity that was assigned to each of the presynaptic neurons in 495 the simulations relatively accurately. For Simulation 1 with common inputs, the estimated latency-distance 496 parameters are correlated with their true values ( 1 ), = .95 , < .01, root mean squared error = .0013 497 AU/s (Fig. 3A) and for Simulation 2 with real presynaptic inputs, = .67, < .01, = .0015 AU/s (Fig. 3D) . 
Given that the model-based approach can recover the properties of presynaptic neurons (type and conduction 522 velocity) and the properties of individual connections, we then ask how well our model can distinguish which 523 pairs of simulated neurons are synaptically connected and which are not. We applied our model and two previously used synapse detection methods: the thresholding method and spike jitter method, to the two 525 simulations described above. Briefly, the thresholding method is based on testing if the peak or trough in the 526 correlogram immediately following a presynaptic spike is significantly different from a constant, baseline number 527 of coincidences. Since the baseline is estimated with a single value, the thresholding method is generally 528 effective in cases where there is little fluctuation but will not work well in situations where there are strong 529 fluctuations (e.g. due to shared common input). To account for these fluctuations, Hatsopoulos et al. (2003) 530 developed a pattern jitter method where jittered spike trains generate a baseline cross-correlogram that 531 preserves slow structure in the correlogram while removing fast, transient effects such as those due to a synaptic 532 connection. The spike jitter method is then based on testing if the peak or trough is significantly different from 533 the local baseline estimated from the jittered spikes (see Methods for more details). In both the thresholding and 534 the jitter methods there is no explicit model for the slow effects and fast, synaptic effects, and each cross-535 correlogram is treated as a separate hypothesis test. In contrast, the extended GLM uses an explicit, parametric 536 structure for the slow and fast effects, as well as constraints based on neuron type and conduction velocity. Although all methods perform well above chance in detecting connections, we find that both the jitter method 552 is set such that the number of false positives is small (less than ~10%) both methods detect far more excitatory 554 connections than inhibitory connections, despite the fact that the number and strengths of excitatory and 555 inhibitory connections were approximately balanced in the simulations. This bias may be partially due to the fact 556 that here, for jitter method and thresholding method, we approximate the noise distribution of the correlograms 557 using a normal distribution (z-scores), rather than using an empirical distribution. On the other hand, the extended 558 GLM shows no preference for either excitatory or inhibitory connections for simulation 1, and a slight bias towards 559 inhibitory connections for simulation 2 (Fig. 4B & E) . 560
In addition to the overall performance and the performance on different cell types, we also expect the detectability 562 of synapses to depend on the synaptic strength and the rates of the pre-and postsynaptic neurons. Here we 563 find that, for both of the simulations, the extended GLM with constraints and the jitter method perform at a similar 564 level for strong connections, but that the extended GLM has better detection for weak connections (Fig. 4C and 565 F). We also find that the performance of both methods varies as a function of the firing rate of presynaptic 566 neurons. Here the extended GLM outperforms the jitter method at all rates, but both of the methods show better 567 performance for synaptic connections where the presynaptic firing rate is high compared to those where rate is 568 low (Fig. 4G) . By incorporating the learned network information, the extended GLM with constraints appears to 569 better detect weak connections and rule out false positives. For example, although both the extended GLM and 570 the jitter method can detect strong connections (Fig. 4H, top two correlograms) , the jitter method has more false 571 positives and false negatives. It may fail to detect a weak connection that does not exceed threshold (the third 572 correlogram), or falsely detect a non-connection if there is noise that exceeds threshold (the bottom correlogram). 573
On the other hand, if the weak connection has a sign and latency consistent with the constraints, the extended 574 GLM can successfully detect it, and if the sign or latency are inconsistent with the constraints, the extended GLM 575 can successfully rule this connection out (Fig. 4H) . In the above results, we set the bin size of the cross-correlograms to 0.5 ms for all the methods to tradeoff 595 between the number of spikes within a bin and the time resolution. However, since bin size may affect 596 performance, we also ran our model, the jitter method and the thresholding method with the bin sizes of 0.25 ms 597 and 1 ms on the Simulation #1. We find that finer time resolution improves the performance of our model-based 598 methods and does impair the performance of the jitter and thresholding methods. However, the best overall 599 performance is at small bin sizes where the latency and time constant of the fast synaptic effect can be accurately 600 estimated ( 
The overall connection probability may also play a role in detection accuracy. Higher connection probabilities 605 may cause more cases where pairs of neurons have spurious correlations due to common drive from a third 606 neuron. Lower connection probabilities could also make the constraints less useful, since there will be fewer 607 connections from which to estimate both types and distance-latency relationships. As a reference, we ran 608 Simulation #1 with increased connection probability (20% for excitatory neurons, 80% for inhibitory). With this 609 denser simulation the performance for all model decreased: the GLM with constraints had an AUC of .97, the recorded in a mouse somatosensory cortex slice culture using a 512-electrode array (see Methods). Here we 616 adopt two representative datasets: dataset #13 and dataset #23, and examine potential connections between 617 neurons with >1000 spikes recorded. Before we run the model on the dataset, in order to get rid of the possible 618 influence of spike sorting problems, we exclude the neuron pairs when there is an anomalous peak or trough 619 right in the middle of the correlogram (<7% of pairs, see Methods for more details). 620
Since we don't know the ground truth about where the synaptic connections are in the in vitro data, we are not 622 able to directly measure the performance of our synapse detection methods. However, we can qualitatively 623 assess whether or not the method gives results consistent with what we expect. We first validate whether our 624 method can correctly classify excitatory neurons and inhibitory neurons by analyzing the shape the spike 625 waveform of each neuron. Previous studies have shown that the excitatory neurons typically have broader spike 626 waveforms, while the majority of inhibitory neurons have narrower spike waveforms ( Barthó et al. 2004 ). In the 627 two datasets used here, the neurons with broader waveforms are more likely to be classified as excitatory 628 neurons by our model based on their putative synaptic connections, but the results for neurons with narrow 629 waveforms are mixed (Fig. 5A) . To quantify the relationship between waveform and connectivity, we fit a 630 Gaussian mixture model with 3 components to the trough-to-peak duration and half-amplitude duration of the 631 waveforms creating three clusters for "broad waveforms", "narrow waveforms", and "outliers". After assigning 632 each neuron to a cluster (based on the posterior probability), we analyze the consistency between the waveform 633 shape and the neuron type given by their putative connections. From the presynaptic neurons with putative 634 connections detected by our method, we find that 77% of the "broad-spiking" neurons are classified as putative We then compare the putative connections detected by the extended GLM and the jitter method on these same 656 datasets. As with our method, we pick the threshold for jitter method based on the maximum MCC (see details 657
in Methods) from Simulation 1 with background fluctuations. In general, the extended GLM and jitter method 658 detect highly distinct sets of connections ( Fig. 5C and 5D ). Here we sort the neurons based on the similarity of 659 their putative connections detected by our method (using hierarchical clustering). For the Hinton plot of our 660 method, the size of each square represents the magnitude of the estimated synaptic weight , of the 661 corresponding neuron pair. For the Hinton plot of jitter method, the size of each square represents the magnitude 662 of the z-score of the corresponding neuron pair. Fig. 6F ). Since the strength 703 of the constraint in our model is partially based on how well the latency-distance relationship is fit by a linear 704 trend, these constraints thus have a weaker influence and our method is still able to detect putative connections 705 at unexpected latencies ( Fig. 6C & 6D) . incorporates two structural constraints learned from the whole network: presynaptic neuron type and the 732 relationship between the synaptic latency and distance between pre-and postsynaptic neurons. On two 733 simulated integrate-and-fire networks, our model outperforms previous synapse detection methods (the 734 thresholding method and spike jitter method), especially on the weak connections. We also apply our model on 735 in vitro multielectrode arrays (MEAs) data. Here our model recovers plausible connections from hundreds of 736 neurons recorded extracellularly. 737 model-based approach outperforms the hypothesis testing-based approaches for a wide range of firing rates 741 and shows particular improvement for detecting weak connections. At the same time, in our simulations, the 742 model-based methods outperform the hypothesis test-based methods at all thresholds. That is, the distributions 743 of likelihood ratios for connections and non-connections are more distinct than the distributions of test statistics 744 with the jitter or thresholding methods. In practice, however, when detecting putative synapses, the choice of 745 threshold has a strong effect on how many synapses are detected and also how many false positives there are. 746
Here, in detecting putative synapses in experimental data we apply the same optimal (MCC maximizing) 747 threshold from the simulation. This is largely for illustration, but selecting an appropriate threshold for 748 experimental recordings depends on the researchers' tolerance for false positives and false negatives. Ultimately, 749 the choice of threshold should be based on the aims of the analysis and the costs/benefits of mistakes in 750 interpreting the underlying data. 751
Since we don't know the ground truth for experimental data, it is possible that the threshold used here might be 753 either too strict or too permissive. However, the performance of the model-based method may be somewhat 754 more robust to the choice of threshold than the jitter and thresholding methods. In our simulations, we find that 755 both the jitter method and thresholding method show strong biases towards detecting excitatory connections, 756 particularly at strict thresholds with few false positives. The model-based approach, on the other hand, detects 757 excitatory and inhibitory connections in proportion to their prevalence in the simulation at all the thresholds. The 758 bias of the jitter method may due to the fact that we here measure test statistics assuming that spike counts 759 follow a normal distribution. This approximation clearly does not accurately account for the fact that spike counts 760 can only be non-negative. However, in practice we find that this type of smooth approximation has better 761 performance at strict thresholds compared to using the empirical count distributions (using the percentile of the 762 true counts in the jittered count distribution), which do not have smooth tails. These biases we find in the 763 simulation results may indicate that, when we apply these methods to real data, jitter method and thresholding 764 method may distort the observed E-I ratio if the threshold is too strict. Consistent with the simulation results, in 765 the in vitro data analysis, we find that the jitter method also typically detects many more excitatory than inhibitory In the model-based approach, we learn two structural constraints from the whole network: presynaptic neuron 773 type and the relationship between the synaptic latency and distance between pre-and postsynaptic neurons. 774
For the presynaptic neuron type, using the simulation, we find that the model-based approach is able to 775 successfully classify most neurons. However, when applying the method to the in vitro data, we compare the 776 neuron type estimated based on putative synaptic connections with waveform shapes, and find that our results 777 are somewhat less clear than previous findings in vivo (Barthó et al. 2004 ). Instead of two, well separated 778 excitatory (broad waveforms) and inhibitory (narrow waveforms) clusters, we find substantial mixing of types 779 across clusters. This may be partially due to the particulars of organotypic slice recording. Previous works have 780 found that the waveforms in these recordings tend to be more triphasic potentially due to axonal conductance 781 For the relationship between the synaptic latency and distance between pre-and postsynaptic neurons, we found 789 that the model-based method can successfully learn linear relationships in simulation and that these constraints 790 improve detection performance. By applying our method to the in vitro data, we also find that for most of the 791 neurons, the synaptic latencies tend to increase with the distance between the pre-and postsynaptic neurons. 792
However, there appears to be a portion of neurons that don't show this pattern. In many cases, we may not have 793 enough putative synaptic connections to estimate such a trend. In the cases where there are enough connections, conduction velocity, it's possible that the dendritic distance constitutes a large portion of the distance. And third, 797 the straight-line distance between somas may not be the same as the trajectory of the axons/dendrites, especially 798 when the neurons are sampled from different barrel fields or different cortical layers. Although previous 799 theoretical work on the minimum wiring length principle might suggest the conduction distance between two 800 neurons can be well approximated with straight-line (Chklovskii et al. 2002; Koulakov and Chklovskii 2001) , there 801 are clearly many sources of uncertainty when estimating conduction velocity here. However, it is important to 802 note that, within the extended GLM, the conduction velocity is only a soft constraint, and the strength of the 803 constraint is related to how accurately the relationship is fit by a straight line. We are still able to detect 804 connections even if the relationship between synaptic latency and distance is not clearly linear. 805 806 With the model-based method, we are able to learn the properties of each presynaptic neuron (type and 807 conduction velocity) and use these properties to better detect individual synaptic connections based whether 808 they are consistent with these properties. In the future application of this method, we could potentially include 809 other sources of information to better estimate these properties. For instance, cell types can be classified 810 according to: mean firing rate, the mode of the inter-spike interval distribution, burstiness, and spike asymmetry 811 using spatiotemporal electrical image generated using the spike waveforms across multiple electrodes (Li et al. 814 2015). In addition, the model-based approach is flexible enough that other constraints could also be incorporated. 815
For instance, we could use constraints based on connectivity across and between brain regions or other network 816 structure (Linderman et al. 2016 ). Additionally, although we have not focused on these measures here, the log 817 likelihood ratios that we use to detect the connections could also be used to calculate p-values (using a likelihood 818 ratio test), and confidence intervals for the estimated synaptic weights can be calculated based on the log 819 likelihood itself. Finally, as neural recording techniques continue developing, increasing numbers of neurons can 820 be recorded simultaneously (Stevenson and Kording 2011). These recordings have the potential to contain more 821 monosynaptic connections per recording, and this should result in more reliable estimation of neuronal properties. 822