 two MAC lipsticks of your choice? Click here to enter, it's easy!
The Control Revolution: Technological and Economic Origins of the Information Society by James Ralph Beniger (Paperback, 1989)
Be the first to write a review.
OUR TOP PICK
$46Why do we find ourselves living in an Information Society? How did the collection, processing, and communication of information come to play an increasingly important role in advanced industrial countries relative to the roles of matter and energy? And why is this change recent or is it?James Beniger traces the origin of the Information Society to major ecomic turver. Inevitably the Industrial Revolution, with its ballooning use of energy to drive material processes, required a corresponding growth in the exploitation of information: the Control Revolution.Between the 1840s and the 1920s came most of the important information-processing and communication techlogies t only for the breadth of its scholarship but also for the subtlety and force of its argument. It will be welcomed by sociologists, ecomists, historians of science and techlogy, and all curious in general.
- Author BiographyJames R. Beniger is Associate Professor at the Annenberg School of Communications, University of Southern California, Los Angeles.
Key Features
- Author(s)James Ralph Beniger
- PublisherHarvard University Press
- Date of Publication01/07/1989
- LanguageEnglish
- FormatPaperback
- ISBN-100674169867
- ISBN-139780674169869
- SubjectPolitics: General & Reference
Publication Data
- Place of PublicationCambridge, Mass
- Country of PublicationUnited States
- ImprintHarvard University Press
- Content Note10 tables, 21 line illustrations, 14 halftones, 1 map
Dimensions
- Weight681 g
- Width152 mm
- Height229 mm
- Spine31 mm
This item doesn't belong on this page.
Thanks, we'll look into this.3 oz. of Butter.
4 Cardamom Seeds.
A few slices of good Bacon.
A tiny piece of Cinnamon.
¾ lb. of White Rice.
Slice the onions very fine, fry a nice brown in the butter, then add the stock, three-quarters of a pound of good white rice, well mashed, and a few slices of bacon or corned pork. Put all into a flat saucepan and cover with one pint of water, taking care to have two inches of gravy above the rice. When the rice is all but done, have ready a boiled fowl, nicely trussed, lay it in the middle of the rice, cover the pot and let it simmer till the rice is nice and dry; serve with the rice all round the fowl, garnished with hard-boiled eggs and slices of bacon. Take care to remove the bag of spices. Shoulder of mutton or lamb may be done in the same way, only difference, the meat to be put in raw with the rice, and no stock need be added.
import gc
from enum import Enum

from typing import List

from util.utils import read_bin, get_total_nvecs_fbin, Shard, read_fbin, SpacePoint, save_shard
from numpy import linalg
from statistics import median
import numpy as np
from scipy.spatial import distance_matrix
from scipy.spatial.distance import pdist
# import tracemalloc
import argparse


# desired number of shardsCreates a new shard graph for a centroid shard
# The shard is an HNSW graph with neighborhoods of the parent centroid.
# The shard is persisted to disk for each addition.
# The shard is loaded from disk and searched when a query is in its centroid neighborhood.
M = 1000

# target maximum distance between points to fall inside a shard
DIST_MULTIPLIER = 2

# size of the sample of points examined linearly during max dist computation
SAMPLE_SIZE = 10000

# batch size for reading points from the input file during the sharding algorithm
BATCH_SIZE = 1000000

# with this minimum saturation % we will save the current shard, if it did not grow further
SHARD_SATURATION_PERCENT_MINIMUM = 75

VERBOSE = False


# expected: 1 280 000 008
# file size: 1 280 0 000 008
def compute_median_dist(points)->float:
    num_rows, num_cols = points.shape
    print("Got the input data matrix: rows = {}, cols = {}".format(num_rows, num_cols))
    print("Points: {}".format(points))

    class DistMethod(Enum):
        METHOD_NUMPY = 1,
        METHOD_PAIRWISE_LOOP = 2,
        SPATIAL_DISTANCE_MATRIX = 3,
        PDIST = 4

    dists = []

    method = DistMethod.PDIST

    if method == DistMethod.METHOD_NUMPY:
        # Method 1: does not work: computes inf on the diagonal and zeroes elsewhere in the resulting matrix
        # dists = np.sqrt(np.sum((points[None, :] - points[:, None])**2, -1))
        dists = np.linalg.norm(points[:, None, :] - points[None, :, :], axis=-1)
    elif method == DistMethod.METHOD_PAIRWISE_LOOP:
        # Method 2: O(Nˆ2) iteration
        for i in range(0, num_rows):
            for j in range(0, num_rows):
                dist = linalg.norm(points[i] - points[j])
                dists.append(dist)
        dists = [linalg.norm(points, 'fro')]
    elif method == DistMethod.SPATIAL_DISTANCE_MATRIX:
        dists = distance_matrix(points, points)
    elif method == DistMethod.PDIST:
        dists = pdist(points)

    print("Distances: {}", dists, flush=True)
    median_dist = median(dists)
    print("Median distance: {}", median_dist, flush=True)

    if median_dist == np.inf:
        print("Distance computation failed")
        exit(0)

    return median_dist


# objective function | loss function like in K-Means
def shard_by_dist(data_file: str, dist: float, output_index_path: str, dtype: np.dtype, shards_m: int = M):
    #tracemalloc.start()

    total_num_elements = get_total_nvecs_fbin(data_file)
    print(f"Total number of points to process: {total_num_elements}", flush=True)
    print(f"Reading data from {data_file} in {BATCH_SIZE} chunks", flush=True)

    range_upper = total_num_elements
    print(f"range_upper={range_upper}", flush=True)

    # set of integer order ids of each point that was already placed into a shard => processed
    processed_point_ids = np.zeros(total_num_elements, dtype=bool)

    # map from globally unique shard id to number of shard's elements
    shards = {}

    # expected number of elements per shard
    expected_shard_size = total_num_elements // shards_m
    print("Expected shard size: {}".format(expected_shard_size), flush=True)

    # get the seed point, which initially is the first point of the dataset
    points = read_bin(data_file, dtype=dtype, start_idx=0, chunk_size=1)
    num_rows, num_cols = points.shape

    # first seed point
    seed_point_id = 0
    seed_point = points[seed_point_id]
    print("Seed point for shard {}: {}".format(seed_point_id, seed_point), flush=True)
    # remember the seed point id
    processed_point_ids[seed_point_id] = True

    # shard contains the points themselves: we pre-create the numpy array to reuse it multiple times
    shard_points = np.empty((expected_shard_size, num_cols))
    shard_points[0] = seed_point
    running_shard_point_id = 1
    shard_id = 0

    global_shard_id = 0

    # shard_ids contains the unique point ids as they come in from the input data structure:
    # we pre-create the numpy array to reuse it multiple times
    shard_point_ids = np.empty(expected_shard_size, dtype=np.int32)
    shard_point_ids[0] = shard_id

    # all seed points, that are by design cluster centroids;
    # these seed